Ir ao conteúdo

Exercicio 1 – Sistemas Operacionais II – INE5424 – UFSC

Trabalho 1 – EPOS
Idle-waiting Thread Joining
– Este trabalho tinha como objetivo alterar o modo que era feito o “join” em uma Thread. Sendo que o mesmo inicialmente era feito da seguinte maneira:
[code lang=”c”] while(_state != FINISHING)
yield();
[/code]

O mesmo consiste basicamente, em verificar o estado da thread que se esta dando join e caso o estado nao seja FINISHING dar a vez a outro processo. Esta solucao, acarreta no consumo excessivo de recursos ja que o mesmo sempre retorna para a fila de _ready. E eh executado novamente quando o escalonador escolher esta thread. O trabalho pede que seja modificado de modo que o consumo de recursos nao seja excessivo.

Arquivos Modificados:
thread.cc
Thread.h

Solucao:
     Foi criada uma variável adicional em threads.h, _waiting_for_me, que é um ponteiro para uma thread. Quando o método “join” é chamado, a thread que está executando é colocada no _waiting_for_me da thread chamada e é suspensa. Se a thread já finalizou ou alguém já chamou “join” nela, nada é feito. No método “exit”, caso _waiting_for_me esteja preenchida, é chamado o método “resume” na thread referenciada.
     Pensamos em colocar uma lista de referências para várias threads poderem dar “join” na mesma thread, porém vimos na documentação do POSIX que isso era considerado um erro lógico, e achamos que acarretaria um consumo de recursos adicional desnecessário, pois não seria possível usar o _link já existente na thread, já que ela teria de estar tanto na lista de suspensos quanto na lista _waiting_for_me da outra thread.

Explicacao mais detalhada da implementacao escolhida e outras solucoes pensadas.

7.807 Comentários

  1. Glad I gave this a chance rather than scrolling past, and a stop at markpillow confirmed I made the right call, sometimes the best content is hidden behind unassuming headlines that do not scream for attention and learning to slow down and check those out has paid off many times now across years of reading.

  2. Started reading expecting to disagree and ended mostly nodding along, and a look at progressigniter continued the pattern, content that wins agreement through evidence and reasoning rather than rhetorical force is the kind that actually shifts minds and this site clearly knows how to do that across what I have read so far.

  3. Самара, всем привет Ситуация знакомая Поилки и таблетки не помогают Короче, единственное что реально спасает — капельница при похмелье с препаратами Через час состояние нормализовалось В общем, телефон и цены тут — прокапаться самара https://kapelnicza-ot-pokhmelya-samara-lhb.ru Капельница — это быстро и эффективно Перешлите тем кто в такой же ситуации

  4. Liked that there was nothing performative about the writing, and a stop at pianoloud continued that genuine quality, performative writing tries to be witnessed rather than read and the difference between performance and substance is huge for the careful reader and this site has clearly chosen substance every time clearly.

  5. Edwincusly Edwincusly

    после вашего обращения наш врач приезжает по указанному адресу с медработниками в гражданской форме и на машине без опознавательных символов, проводит осмотр, собирает историю болезни (анамнез).
    Подробнее можно узнать тут – вывод из запоя цена в сочи

  6. Reading this on the train into work was a better use of the commute than my usual choices, and a stop at vexsync extended that commute reading well, content that improves transit time rather than just filling it is content with practical benefit and this site has earned its place in my morning commute reading rotation.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *