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.

4.925 Comentários

  1. Following a few of the internal links revealed more posts of similar quality, and a stop at learnandexpand added more to that growing pile, sites where internal links lead to more good content rather than to more of the same recycled material are sites with depth and this one has clearly built that depth carefully.

  2. Closed the tab with a small sense of finality rather than the usual rushed exit, and a stop at learnandtransformideas 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.

  3. Reading this slowly to give it the attention it deserved, and a stop at buildyournextstep earned the same slow read, choosing to read slowly is a small act of respect for content quality and very few sites earn that respect from me but this one did so without any explicit ask which is the cleanest way.

  4. Definitely returning here, that is decided, and a look at jazbox only made the case stronger, this is one of those rare websites that rewards regular visits rather than feeling stale after the first read which is something I cannot say about most of the places I bookmark today across all my topics.

  5. Started reading and ended an hour later without realising the time had passed, and a look at bomboard produced the same time dilation effect, when content makes time feel different the writer has achieved something well beyond the average and this site is producing that experience for me reliably across multiple readings.

  6. Approaching this site through a casual link click and being surprised by what I found, and a look at createimpactframework extended the surprise, the rare experience of stumbling into excellent independent content rather than predictable mediocrity is one of the actual remaining pleasures of casual web browsing and this site provided it cleanly.

  7. GeraldHoulk GeraldHoulk

    Обзор посвящён процессу восстановления после зависимостей. Мы расскажем о различных этапах реабилитации, поддерживающих ресурсах и важности мотивации в достижении устойчивого выздоровления.
    Разобраться лучше – снятие интоксикации на дому

  8. This web site certainly has all the information I wanted about this subject
    and didn’t know who to ask.

  9. More original than the recycled takes I keep finding on the topic elsewhere, and a quick look at ilefix confirmed it, the kind of site that has its own voice rather than echoing whatever is trending which makes it stand out as a refreshing change from the usual rotation of generic content I see daily.

  10. Generally I am cautious about recommending sites on first encounter but this one warrants the exception, and a look at globalpremiumfinds 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.

  11. Speaking carefully because I do not want to overstate things this site is genuinely above average across multiple measurements, and a stop at discovergrowthstrategies continued the above average performance, the calibration of judgement against potential overstatement is something I take seriously and this site clears the higher bar even after that calibration applies.

  12. Picked up something useful for a side project, and a look at createvisionforward added another piece I will incorporate, content that connects to specific projects I am working on is content with practical utility and the practical utility of this site is showing up across multiple posts I have read in the last hour or so.

  13. Better signal to noise ratio than most places I check on this kind of topic, and a look at hunhax kept that going, every paragraph here carries something worth reading rather than padding out the page to hit some arbitrary length target that search engines reward but readers ignore as soon as they notice it.

  14. Decided to read this site for a while before forming a verdict, and the verdict after several pages is positive, and a stop at jazbox continued that pattern, judging a site requires more than one post and giving sites a fair sample is something I try to do for promising candidates rather than rushing to dismiss.

  15. Liked the way the post got out of its own way, and a stop at ilefix extended that invisible craft, the best writing you barely notice while reading because it is doing its work without drawing attention to itself and this site has clearly mastered that disappearing act across the pieces I have read.

  16. If you asked me to point to a recent positive sign for the open web this site would be near the top, and a stop at globalpremiumfinds reinforced that designation, the few sites that serve as evidence the web can still produce quality independent content are precious and this one has clearly become one for me.

  17. I learned more from this short post than from longer articles I read earlier today, and a stop at uplandharborvendorparlor added even more useful detail without going off topic, this site clearly knows how to keep things focused without sacrificing depth which is a hard balance to strike for any writer.

  18. Adding to the bookmarks now before I forget, that is how good this is, and a look at jikbond confirmed the rest of the site is worth saving too, this is one of those rare finds that justifies the time spent searching the web for once which is a relief in the current environment.

  19. A thoughtful read in a week that has been mostly noisy, and a look at discoverfuturepaths carried that thoughtful quality across more pages, finding pockets of considered writing in a week of distractions is one of the small wins of careful curation and this site is providing those pockets at a sustainable rate.

  20. Useful information presented in a way that does not feel like a sales pitch, that is what I appreciated most, and a stop at createclaritysteps was the same, no upsell and no fake urgency just steady content laid out properly for someone trying to actually learn from it rather than just be sold to.

  21. Now considering writing a longer note about the post somewhere, and a look at hunhax added more material for that note, content that prompts me to write rather than just consume is content with generative energy and this site is producing that generative effect for me at a higher rate than most sources.

  22. Worth marking this site as one to come back to deliberately rather than by accident, and a stop at explorefreshapproaches reinforced that intention, the difference between sites I find again by chance and sites I return to on purpose is meaningful and this one has clearly moved into the deliberate return category for me.

  23. Now appreciating that I did not feel exhausted after reading, and a stop at slacktally 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 *