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

  1. Just want to flag that this was useful and not bury the appreciation in caveats, and a look at fashionlifestylehub earned the same direct praise, recognising good work without hedging it with criticism is something I try to practice because over qualified compliments tend to read as backhanded and miss the point sometimes.

  2. Found this through a search that was generic enough I did not expect quality results, and a look at modernlivingemporium continued the surprisingly good experience, search engines occasionally still surface excellent independent content if you scroll past the obvious paid and high authority results which is reassuring to remember sometimes.

  3. Reading this slowly in the morning before opening email, and a stop at lobbycommune extended that protected attention, content that earns the prime morning reading slot before the daily distractions begin is content with elevated status and this site has earned that prime slot consistently in my recent reading habits clearly.

  4. Came away feeling slightly smarter than I was when I started, that is a real win, and a stop at edgedial added a bit more to that, the rare site that actually transfers some of its knowledge to the reader in a way that sticks rather than just creating an illusion of learning briefly.

  5. Generally I bookmark sparingly to avoid building up a bookmark graveyard but this one earned a permanent slot, and a stop at mossbreeze extended that permanence designation, the few sites I keep permanent bookmarks for are sites I expect to use repeatedly and this one has clearly cleared that expectation bar today.

  6. Once I trust a site this much I tend to read everything they publish and that is the trajectory I am on with this one, and a stop at evertrueharbor confirmed the trajectory, the rare progression from interested reader to comprehensive reader is something only certain sites earn and this one is earning that progression rapidly.

  7. Found this really helpful, the explanations are simple but they actually answer the questions a normal reader would have, and after I followed northernriveroutlet I had a clearer sense of the topic, no extra fluff just useful points laid out in a sensible order that made the time worth it.

  8. A piece that did not require external context to follow, and a look at draftlog maintained the same self contained quality, content that stands alone without forcing readers to chase prerequisites is more accessible and this site has clearly thought about how each piece can serve a fresh visitor rather than only existing members.

  9. Saving the link for sure, this one is a keeper, and a look at trendforless confirmed I should bookmark the entire site rather than just this page, the consistency across what I have seen so far suggests there is a lot more here worth coming back for soon when I have more time.

Deixe um comentário

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