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

  1. yourtimeisnow yourtimeisnow

    A piece that built up gradually rather than front loading its main points, and a look at yourtimeisnow maintained the same gradual structure, content that trusts the reader to reach conclusions through accumulating reasoning is more persuasive than content that announces conclusions and then defends them and this site uses the persuasive approach.

  2. Started thinking about my own writing differently after reading, and a look at musebeat continued that reflective effect, content that influences how I work rather than just informing what I know is content with the highest kind of impact and this site has triggered some of that reflective influence today on me.

  3. Looking forward to seeing what gets published next month, and a look at futuregrovegallery extended that anticipation across the broader site, finding myself looking forward to a sites future content rather than just consuming its existing content is a stronger commitment level than I usually reach with new finds and this site triggered that.

  4. Liked the natural conversational tone throughout, never stiff and never overly casual either, and a stop at foxarbor kept that comfortable middle ground going, finding a tone that respects the reader without becoming distant or overly familiar is harder than it sounds and this site nails that balance consistently across many different pieces.

  5. A well calibrated piece that knew its scope and stayed inside it, and a look at epicinlet maintained the same scope discipline, scope creep is one of the failure modes of long blog posts and this site has clearly invested in the editorial discipline to prevent it which shows up in tightly contained pieces.

  6. Found a couple of useful angles in here I had not considered before reading carefully, and a quick stop at dreamharbortrends added more, this is one of those sites where the value compounds the more you read rather than peaking at one viral post and then offering nothing else of substance afterwards which is common.

  7. Better than most of the writing I have come across on this topic recently, simpler and more direct, and a look at isleparish continued in that same way, a real outlier in a crowded space full of repetitive content that says little while taking up a lot of reader time today which is unfortunate.

  8. Adding this site to my regular reading list, the post earned that on its own, and a quick stop at edenfair sealed the decision, the kind of place worth checking back with from time to time because it consistently produces material that holds up against a critical reading too which I really value.

  9. Reading this fit naturally into my afternoon walk because I was reading on my phone, and a stop at modernhomeculture continued well in that walking format, content that survives mobile reading without becoming awkward is content with format flexibility and this site has clearly thought about how it reads across different devices today.

Deixe um comentário

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