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.

8.256 Comentários

  1. Closed it feeling I had taken something away rather than just consumed something, and a stop at capitalties extended that taking away feeling, the difference between content I extract value from and content I just pass through is something I track informally and this site is consistently in the value extraction column for me.

  2. Now noticing the careful balance the post struck between confidence and humility, and a stop at unifiedtrusthub maintained the same balance, finding the line between asserting and admitting is hard and this site has clearly developed the calibration to walk that line consistently which produces a more persuasive reading experience for me.

  3. Terryduago Terryduago

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

  4. I like the valuable information you provide in your articles.

    I will bookmark your weblog and check again here regularly.
    I’m quite sure I will learn a lot of new stuff right here!
    Best of luck for the next!

  5. Now appreciating that I did not feel exhausted after reading, and a stop at motionclarity extended that energising quality, content that leaves me with more attention than it consumed is rare and the gap between draining and energising content is real over the course of a typical day spent reading widely online.

Deixe um comentário

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