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.914 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.

Deixe um comentário

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