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.

5.309 Comentários

  1. Found the use of subheadings really helpful for scanning back through the post later, and a stop at startbuildingmomentumpath kept that reader friendly approach going, navigation is something many blog writers ignore but small structural choices make a noticeable difference for someone returning to find a specific point again days or weeks later.

  2. Most of my reading time goes to a small number of trusted sources and this one is now joining that group, and a stop at growresultsdrivenpath reinforced the group membership, the few sites that earn a place in my regular rotation are sites I expect ongoing returns from and this one has earned that elevated position consistently.

  3. Top quality material, deserves more attention than it probably gets, and a look at findnewopportunitydirections reflected the same effort across the site, a hidden gem in the modern web where most attention goes to whoever shouts loudest rather than whoever actually delivers the best content for their readers without much marketing fanfare.

  4. Skipped to a specific section because I knew that was the question I had, and the answer was clean, and a stop at findyourcoremomentum similarly delivered targeted answers without burying them, content engineered for readers who arrive with specific needs rather than open ended browsing is increasingly valuable in a search heavy reading environment.

  5. After several visits I am now confident this site is one to follow seriously, and a stop at directioncreatesenergy reinforced that confidence, the gradual building of trust through repeated quality exposures is the only sustainable way to develop reader loyalty and this site is building that loyalty in me through patient consistent work consistently.

  6. Honest take is that I will probably forget most of what I read online today but this post is one I will remember, and a stop at learnandprogressconsistently kept that same memorable quality going, certain writing leaves a residue in the mind in a way most content simply does not manage.

  7. Reading this post made me realise I had been settling for lower quality elsewhere, and a look at startnextleveldirectionfast extended that recalibration, content that exposes how much I had been accepting in adjacent sources is content with calibrating effect on my standards and this site is performing that calibration function across topics for me reliably.

  8. Halfway through reading I knew this would be one to bookmark, and a look at directionalclarityhub confirmed that early intuition, when bookmark intent forms before finishing a post you know the writing has cleared a quality bar that most content fails to clear and this site has cleared it on multiple visits already.

  9. If patience for careful reading is rare these days finding sites that reward it is rarer still, and a stop at growwithsteadyfocus extended that rare reward, the diminishing returns on shallow content reading have made me more selective about where to spend reading time and this site is meeting the higher selectivity bar consistently.

Deixe um comentário

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