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

  1. Honestly enjoyed every minute spent here, that is not something I say lightly, and a look at simplelivingmarket confirmed I will be back, the bar for spending time online is high for me these days but this site clears it without effort which is high praise indeed from this reader who is usually rather demanding.

  2. Skipped the social share buttons but might come back to actually use one later, and a stop at globaltrendoutlet extended that share urge, content that triggers genuine sharing impulses rather than performative ones is content that has actually moved me and not many posts in a typical week do that for me actually.

  3. wildwoodfashion wildwoodfashion

    My professional context would benefit from having this kind of resource available, and a look at wildwoodfashion extended the professional applicability, the rare site that contributes meaningfully to professional work rather than just personal interest is content with multiplied value and this one is providing that professional utility consistently across multiple pieces.

  4. Worth pointing out that the post avoided the temptation to summarise everything at the end, and a look at honestharvesthub continued that confident closing approach, content that trusts readers to retain the substance without being reminded of it at the end is content that respects the reader and this site practices that respect.

  5. findpurposeandpeace findpurposeandpeace

    Liked that there was nothing performative about the writing, and a stop at findpurposeandpeace continued that genuine quality, performative writing tries to be witnessed rather than read and the difference between performance and substance is huge for the careful reader and this site has clearly chosen substance every time clearly.

  6. A piece that exhibited the kind of patience that good writing requires, and a look at happylivingoutlet continued that patient quality, hurried writing is easy to spot and this site reads as having been written without time pressure which produces a different feel than the rushed content that dominates much of the modern blog space.

  7. Felt the writer respected the topic without being precious about it, and a look at globaltrendoutlet continued that respectful but unfussy treatment, finding the right register for serious topics is hard and this site has clearly figured out how to take the topic seriously while still being readable for casual visitors regularly.

  8. fashionpicksmarket fashionpicksmarket

    Great work on keeping things readable, the post never drags or repeats itself which I really appreciate, and a stop at fashionpicksmarket added a bit more context that fit naturally with what was already said here, no need to read everything twice to get the point being made today.

  9. Took something from this I did not expect to find, and a stop at honestharvesthub added another unexpected useful piece, content that exceeds expectations rather than just meeting them is the kind that builds enthusiasm and earns repeat visits without any explicit ask from the writer or platform behind the work being read.

  10. A piece that took its time without dragging, and a look at shopandsmiletoday kept the same patient pace, the difference between unhurried and slow is a fine editorial distinction and this site has clearly found the unhurried side without slipping into the slow side which would have lost me as a reader quickly otherwise.

  11. Thanks for the breakdown, it gave me a clearer picture of something I had been confused about for a while now, and a stop at newvoyagecorner closed the remaining gaps in my understanding nicely, no need to hunt around twenty other articles to put the pieces together which is a real time saver.

Deixe um comentário

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