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.569 Comentários

  1. usa what does casino mean in french (Toney) providers, 2021 no deposit bonus codes nz and free online pokies win real money united kingdom, or online slots guide uk

  2. SonnyVix SonnyVix

    Врач учитывает симптомы, риски, анамнез и семейную ситуацию, чтобы предложить подходящую программу.
    Подробнее можно узнать тут – vyvod-iz-zapoya-v-stacionare-moskva

  3. A piece that ended with a clean landing rather than fading out, and a look at wildbranchoutlet maintained the same crisp conclusions, endings that resolve rather than dissolve are a sign of careful structural thinking and this site has clearly invested in how its pieces conclude rather than letting them simply run out of energy.

  4. Thanks for the honest framing without exaggerated claims that the topic will change my life, and a stop at moonveilgoods kept the same modest tone, restraint in marketing language signals trustworthiness and the writers here are clearly playing the long game by building credibility rather than chasing immediate clicks through hyperbole.

  5. Reading this in a quiet hour and finding it suited the quiet, and a stop at stonepetalshop extended the quiet reading mood, content that matches its own optimal reading conditions rather than fighting them is content that has been thoughtfully calibrated and this site reads as having a particular reading mood in mind throughout.

  6. Бишкек, салам! То выплаты выигрышей задерживают по двое суток, Искал реально долго, перепробовал кучу сомнительных вариантов пока чисто случайно не нашел наконец толковую рабочую платформу, начиная от удобного интерфейса и заканчивая официальной лицензией. Вывод честно заработанных денег занимает буквально 5 минут,

    Кому тоже актуально найти проверенное место для игры, жмите на источник, чтобы случайно не потерять контакты букмекерская контора бишкек букмекерская контора бишкек Не ведитесь на дешевые лохотроны из рекламы, обязательно перешлите этот пост тому, кто тоже сейчас ищет нормальную контору!

  7. Bookmark earned, calendar reminder set, share queued, all from one good post, and a look at findsmarteroptions did the same, when a single reading session triggers multiple downstream actions you know the content has actually moved me beyond the page and this site is moving me at that higher level reliably.

  8. Reading this on a difficult day was a small bright spot, and a stop at createforwardprogress extended that brightness, content that improves a hard day is content that has earned a particular kind of place in my reading habits and this site is occupying that uplifting role for me today which I appreciate clearly.

  9. Hey there, You’ve performed a great job. I’ll certainly digg it and in my opinion suggest to my friends. I’m sure they will be benefited from this site.

  10. Stayed longer than planned because each section earned the next, and a look at createforwardprogress kept that pulling effect going across more pages, the kind of subtle pull that good writing exerts on attention is something I find harder and harder to resist when I encounter it on the open web today.

  11. Yesterday I was complaining about the state of online writing and today this site has temporarily fixed that complaint, and a look at ironleafmarket extended that mood reversal, the short term mood improvement that comes from finding good content is real and this site has produced that improvement for me at a useful moment.

  12. Excellent execution from start to finish, the post never loses its rhythm and the points stay sharp, and a quick stop at reliableonlinebuys kept the same level going, consistency like this across a site is the marker of a serious operation rather than a casual side project running on autopilot somewhere else.

  13. Appreciated the way each section connected smoothly to the next without abrupt jumps, and a stop at reliableonlinebuys kept that flow going nicely, transitions are something most blog writers ignore but the difference is huge for the reader who is trying to follow a sustained line of thought today across many different topics.

  14. DuncanBip DuncanBip

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

  15. Came here from another site and ended up exploring much further than I planned, and a look at ashenfernshop only encouraged more exploration, the kind of place where one click leads to another not through manipulative design but through genuinely interesting content is rare and worth highlighting when found like this somewhere on the open internet.

  16. Solid little post, the kind that does not need to be flashy because the substance is doing the work, and a look at bondkeystone kept that quiet confidence going across the site, this is what writing looks like when the writer trusts the content to land on its own without theatrics or unnecessary attention seeking behaviour.

Deixe um comentário

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