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

  1. A piece that did not lean on the writer credentials or institutional backing, and a look at deoblob maintained the same focus on substance, content that earns trust through quality rather than through name dropping is the kind I find most persuasive and this site is clearly playing on the substance side of that distinction.

  2. Now planning a longer reading session for the archives, and a stop at vaultscript confirmed the archives are worth that longer commitment, sites with archives I want to read deliberately rather than just sample are rare and this one has clearly earned that level of interest based on the consistency of what I have already read.

  3. Felt this in a way I cannot quite explain, the topic just hit different here, and a stop at discoveropportunityflows continued in that vein, sometimes you find a site whose perspective lines up with how you have been thinking and reading their work feels like a small relief which I appreciated more than I expected.

  4. A piece that did exactly what it promised in the headline without overshooting or underdelivering, and a look at buildsmarthabits continued that calibration, alignment between promise and delivery is a basic editorial virtue that many sites fail at and this site has clearly mastered the matching of expectation and substance throughout pieces.

  5. Glad I gave this a chance rather than scrolling past, and a stop at bexedge confirmed I made the right call, sometimes the best content is hidden behind unassuming headlines that do not scream for attention and learning to slow down and check those out has paid off many times now across years of reading.

  6. Walked away in a slightly better mood than when I started reading, that says something about the writing, and a stop at startfreshthinking kept that going, content that leaves you feeling more capable rather than overwhelmed is the kind I keep coming back to again and again over the years and across many topics.

  7. Thanks for treating the topic with the seriousness it deserves without becoming pompous about it, and a stop at findgrowthchannels continued that balanced treatment, the gap between earnest and self serious is huge and writers who can stay on the right side of it earn my respect when I find them online today.

  8. Closed the laptop and walked away thinking about the post for a good twenty minutes, and a stop at swampstaple produced similar lingering thoughts, content that survives the closing of the browser tab is content that has actually entered the mind rather than just decorating the screen for the duration of the reading.

Deixe um comentário

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