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.

2.508 Comentários

  1. A piece that prompted a small mental rearrangement of how I order related ideas, and a look at staymotivatedalways extended that rearranging effect, content that affects the structure of my thinking rather than just adding to it is content with the deepest kind of impact and this site is reaching that depth for me today.

  2. A piece that handled a controversial angle without becoming heated, and a look at rankquest continued that calm engagement, content that can address contested topics without inflaming them is doing rare diplomatic work and this site has clearly developed the editorial maturity to handle sensitive material with the appropriate temperature of writing throughout.

  3. Took a screenshot of one section to come back to later, and a stop at linknudge prompted another saved tab, the urge to capture and revisit specific pieces of content is something I rarely feel but when I do it tells me the work is worth more than the average passing read for sure.

  4. The pacing of the post was just right, never rushed and never dragged out unnecessarily, and a look at discovernewhorizons maintained the same rhythm, you can tell the writer has experience because the difficult skill of pacing is something only practiced writers manage to handle well in long form content over time and across formats.

  5. digitalpickmarket digitalpickmarket

    Glad I gave this a chance instead of bouncing on the headline, and after digitalpickmarket I was certain I had made the right call, snap judgements based on titles miss a lot of good content and this is a reminder to slow down and check things out before scrolling past in a hurry.

  6. I’m not that much of a internet reader to be honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your website to come back later.
    Many thanks

  7. ranksurge ranksurge

    Generally I am cautious about recommending sites on first encounter but this one warrants the exception, and a look at ranksurge reinforced the exception making, the rare site that justifies breaking my normal cautious approach is the rare site worth flagging early and this one has prompted exactly that early flagging response from me.

  8. gladeridgemarketparlor gladeridgemarketparlor

    Closed the tab with a small sense of finality rather than the usual rushed exit, and a stop at gladeridgemarketparlor produced the same considered closing, when reading ends with deliberate satisfaction rather than impatient skip you know the time was well spent and this site is producing those satisfying endings consistently across what I read.

Deixe um comentário

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