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

  1. Now adding this to a list of sites I want to see flourish, and a stop at gunbolt reinforced that wish, the few sites I actively root for are sites that produce the kind of work I want more of in the world and this one has joined that small list based on what I have read so far.

  2. Picked up a couple of new ideas here that I can actually try out, and after my visit to sheentrundle I have even more notes saved, this is the kind of resource that pays you back for the time you spend on it which is rare to come across in this corner of the web.

  3. This filled in a gap in my understanding that I had not even noticed was there, and a stop at unicorntiger did the same, the kind of post that gives you more than you expected when you first clicked through from somewhere else, a real find for anyone curious about the area covered here.

  4. Thanks for not padding this with the usual filler intros and outros that every other blog seems to require, and a quick visit to jararch continued that lean approach across more posts, content stripped of waste is content that respects you and I will always come back to that kind of approach.

  5. Well done, the kind of post that makes you slow down and actually read instead of skimming for keywords, and a look at orbitnomad kept me reading carefully too, that is a sign of writing that has been crafted rather than churned out for an algorithm to see today and tomorrow.

  6. Bookmark folder created specifically for this site, and a look at vyxarc confirmed the dedicated folder was the right call, dedicated folders for individual sites are a level of organisation I rarely deploy and this site has earned that level of dedicated tracking based on the consistency I have seen so far across sessions.

  7. Picked this up between two other things I was doing and got drawn in completely, and after crecall my original tasks were completely forgotten for a while, content that derails a workflow in a positive way by being more interesting than what you were already doing is rare and worth recognising clearly.

  8. Generally I bookmark sparingly to avoid building up a bookmark graveyard but this one earned a permanent slot, and a stop at huiyam extended that permanence designation, the few sites I keep permanent bookmarks for are sites I expect to use repeatedly and this one has clearly cleared that expectation bar today.

  9. Solid value for anyone willing to read carefully, and a look at discoverideasworthsharing extends that value across the rest of the site, this is the kind of place that rewards return visits rather than offering everything in a single splashy post and then leaving readers nothing to come back for later which is unfortunately common.

  10. Coming to this with low expectations and being pleasantly surprised by the substance, and a stop at vyxarc continued exceeding expectations, the recalibration of expectations upward across multiple positive readings is one of the actual rewards of careful browsing and this site is providing that recalibration at a steady rate apparently.

  11. Came in confused about the topic and left with a much firmer grasp on it, and after snareshale I felt I could explain this to someone else without hesitation, that is the gold standard for any educational content and most sites simply fail to reach it ever which is unfortunate but true.

  12. Reading this slowly to give it the attention it deserved, and a stop at hekfox earned the same slow read, choosing to read slowly is a small act of respect for content quality and very few sites earn that respect from me but this one did so without any explicit ask which is the cleanest way.

  13. My usual response to new bookmarks is to forget them but this one I have already returned to twice, and a look at sundaestudio pulled me back a third time, the actual return rate to bookmarked sites is the real measure of value and this one is clearing that measure at a notable rate already.

  14. Will be sharing this with a couple of people who care about the topic, and a stop at discoverideasworthsharing added more material worth passing along, the kind of site that is generous with quality content and does not make you jump through hoops to access it which is appreciated more than the team probably realises.

  15. Closed the tab with a small sense of finality rather than the usual rushed exit, and a stop at syrupspire produced the same considered closing, when reading ends with deliberate satisfaction rather than impatient skip you know the time was well spent and this site is producing those satisfying endings consistently across what I read.

  16. Considered as a whole this site has developed a coherent point of view that comes through in individual pieces, and a look at findyourdirectiontoday continued displaying that coherence, sites with a unified perspective rather than a grab bag of takes are sites with editorial maturity and this one has clearly developed that maturity through years of work.

  17. Glad the writer did not feel compelled to cover every possible angle of the topic, focus is a virtue, and a stop at gunlex reflected the same disciplined scope, knowing what to leave out is half of what makes good writing good and this post has clearly been edited with that principle in mind.

  18. Reading this gave me a small sense of progress on a topic I have been slowly working through, and a stop at scopevoice added another step forward, learning happens in small increments across many sources and finding sources that consistently contribute is the actual practical value of careful curation in an information rich world.

  19. A piece that took its time without dragging, and a look at curatedqualityhub 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.

Deixe um comentário

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