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.

3.413 Comentários

  1. Worth saying this site reads better than most paid newsletters I have tried, and a stop at isleprairie confirmed that comparison, the bar for free content is often lower than for paid but this site clears the paid bar consistently and that says something about the editorial approach behind the work being published here regularly.

  2. Decided not to comment because the post said what needed saying, and a stop at dazzquay continued that complete feel, content that does not invite obvious additions or corrections from readers is content that has been carefully considered and this site appears to consistently produce pieces that satisfy rather than provoke unnecessary follow ups.

  3. Took the time to read every paragraph rather than skimming for the punchline, and a quick visit to brighttimbermarket earned the same careful attention from me, that is the highest signal I can give about content quality because my default mode is rapid scanning rather than deliberate reading on most pages.

  4. Now realising the topic deserved better treatment than it has been getting elsewhere, and a look at briskolive extended that broader recognition, content that exposes the gap between actual quality and average quality elsewhere is doing the quiet work of raising standards and this site is contributing to that elevation in its own corner.

  5. Reading this brought back the satisfaction I used to get from blogs ten years ago, and a stop at sunsetpinecorner kept that nostalgic quality alive, sites that capture what was good about an earlier era of internet writing are increasingly precious and this one is doing that without feeling like a deliberate throwback at all.

  6. Picked this for a morning recommendation in our company chat, and a look at lunarbranchstore suggested I will mention this site again later, recommending content into a workplace context is a small editorial act that requires confidence in the recommendation and this site is making me confident in those recommendations consistently here too.

  7. Honest take is that this was better than I expected when I clicked through, and a look at lunarcrestlifestyle reinforced that, the bar for online content has dropped so much that finding something thoughtful and well constructed feels almost noteworthy now which says more about the average than about this site itself.

  8. Now noticing the careful balance the post struck between confidence and humility, and a stop at meritpoise 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.

  9. During a quiet evening reading session this provided just the right depth without being heavy, and a stop at briskolive maintained the same evening appropriate weight, content with depth that does not exhaust the reader is content with editorial calibration and this site has clearly figured out how to be substantial without being demanding all the time.

  10. Took me back a step or two on an assumption I had been making, and a stop at urbanmeadowboutique pushed that reconsideration further, writing that gently corrects the reader without being aggressive about it is a rare diplomatic skill and the team here clearly knows how to land critical points without turning readers off.

  11. purefashionchoice purefashionchoice

    A modest masterpiece in its own quiet way, and a look at purefashionchoice confirmed the same quiet quality across the rest of the site, calling something a masterpiece is usually overstating but for content this carefully crafted the word feels appropriate even if the writers themselves would probably resist the label honestly.

  12. Worth flagging this site to a few specific friends who would appreciate the editorial sensibility, and a look at lunarcrestlifestyle added more pages I will mention to them, recommending sites to specific people requires understanding both the site and the person and this site is making those personalised recommendations easy and natural for me.

  13. Came across this and immediately thought of a friend who would enjoy it, and a stop at meritpoise also reminded me of someone, content that triggers the urge to share is content that has earned my recommendation and this site has earned multiple from me already across different conversations during the week.

Deixe um comentário

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