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

  1. Now noticing that the post avoided the temptation to be funny in places where humour would have undermined the substance, and a stop at solarorchardmarketparlor maintained the same restraint, knowing when to be serious is a rare editorial virtue and this site has clearly developed it through what I assume is careful editorial practice over years.

  2. Picked something concrete from the post that I will use immediately, and a look at buildstrongmomentum added another concrete piece, content that produces immediately useful output rather than just abstract appreciation is content that earns its place in my regular rotation without needing any further evaluation from me at this point honestly.

  3. Now noticing that the post never raised its voice even when making a strong point, and a look at learnandaccelerategrowth continued that calm volume, content that can make important points without resorting to typographic emphasis or emotional appeal is content that trusts its substance to do the work and this site has that confidence consistently.

  4. Clean writing, easy to read, and never tries too hard to impress, that combination is harder to find than people think, and after my time on createimpactstructure I am sure this site treats its readers well, no flashy tricks just useful content done right which is honestly all I want online.

  5. A particular kind of restraint shows up in the writing, and a look at buildstrongmomentum maintained the same restraint across pages, knowing what not to say is just as important as knowing what to say and this site has clearly developed strong instincts on both sides of that editorial line throughout pieces I have read.

  6. Good clean post, no errors and no awkward phrasing that breaks the reading flow, and a stop at createimpactstructure kept the same standard, definitely the kind of editorial care that earns a return visit because it tells me the writer is paying attention to details that matter to readers rather than just rushing publication.

  7. I like what you guys are up too. This sort of clever work and reporting!
    Keep up the excellent works guys I’ve incorporated you
    guys to blogroll.

  8. Appreciate how nothing here feels copied or pieced together from other places, the voice is consistent and the tone stays human, and after I checked hupbolt I noticed the same style holds, which is a small detail but it makes the whole experience feel personal rather than like another generic site.

  9. A thoughtful piece that did not strain to be thoughtful, and a look at exploreinnovativepaths continued that effortless quality, when thinking shows up in writing without the writer drawing attention to it you know you are reading something genuinely considered rather than something performing the appearance of consideration which is also common online.

Deixe um comentário

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