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.

7.860 Comentários

  1. Worth a slow read rather than the fast scan I usually default to, and a look at buildprogresswithintent earned the same slower pace from me, content that resets my reading speed downward is content with substance worth absorbing and this site has produced that effect on me multiple times now over the last week here.

  2. Now appreciating that the post left me with enough to say in a follow up conversation, and a look at ardenburst added more material for those follow ups, content that prepares me for related conversations rather than just informing me alone is content with social utility and this site provides that social armament reliably for me.

  3. Closed my email tab so I could read this without interruption, and a stop at buyrova earned the same protected attention, when content is good enough to defend against the usual digital distractions you know it deserves better than the half attention most online reading gets in a typical busy day.

  4. Solid little post, the kind that does not need to be flashy because the substance is doing the work, and a look at minimmoss 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.

  5. Glad I clicked through from where I did because this turned out to be worth the time spent, and after dealvilo I had a fuller picture, the kind of content that earns its visitors through delivering value rather than chasing them through aggressive advertising or constant pop ups appearing everywhere on the screen lately.

  6. Люди подскажите Муж просто умирает на глазах Дети боятся заходить в комнату Платная клиника просит бешеные деньги Короче, спасла только госпитализация — наркологический стационар цена адекватная Провели полную детоксикацию В общем, вся инфа по ссылке — стационар для наркоманов https://narkologicheskij-staczionar-moskva-bny.ru Не ждите пока станет хуже Перешлите тем кто в беде

  7. A quiet kind of confidence runs through the writing, and a look at pilotlobe carried that same understated assurance, confidence without bragging is the most attractive register for online writing and the writers here have clearly developed it through practice rather than affecting it through stylistic tricks that would feel hollow eventually.

  8. Now setting this aside as a model of how to write thoughtfully on the topic, and a stop at directioncrafting extended that model status, content that becomes a reference for how a kind of writing should be done is content with influence beyond its own readership and this site is reaching that level for me clearly today.

  9. Здорова, народ Брат потерял человеческий облик Дети боятся заходить в комнату Платная клиника просит бешеные деньги Короче, спасла только госпитализация — наркологический стационар с интенсивной терапией Врачи и медсёстры 24/7 В общем, телефон и цены тут — наркологические центры москвы цены https://narkologicheskij-staczionar-moskva-bny.ru Стационар — это единственный выход Перешлите тем кто в беде

Deixe um comentário

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