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

  1. Decided I would read the archives over the weekend, and a stop at kindvendor confirmed that the archives would be worth the time, very few sites have archives I would actively read through but this one has earned that level of interest based on the consistent quality across what I have sampled so far.

  2. Felt a small spark of recognition when the post named something I had been struggling to articulate, and a look at brightmoonridge produced more such moments, the rare service of giving readers language for fuzzy intuitions is one of the higher values that good writing can provide and this site offered several today instances.

  3. Liked the careful selection of which details to include and which to skip, and a stop at frostrack reflected the same editorial judgement, knowing what to leave out is just as important as knowing what to include and this site has clearly figured out where that line sits for the topics it covers regularly.

  4. Bookmark earned and folder updated to track this site separately, and a look at designconsciousmarket confirmed the folder upgrade was the right call, organising my reading list so that good sites do not get lost in a sea of casual bookmarks is something I do more carefully now and this site warranted its own spot.

  5. Started reading without much expectation and ended on a high note, and a look at elevatedconsumerexperience continued that arc, content that builds rather than peaks early is a sign of a writer who knows how to structure a piece for sustained reader engagement rather than relying on a strong hook to do all the work.

  6. Took something from this I did not expect to find, and a stop at baroncleat 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.

  7. Thank you for not assuming the reader already knows everything, the explanations meet me where I am, and a look at designconsciousmarket did the same, that consideration is what makes a site feel welcoming rather than gatekeepy which is sadly the default mood across the modern web today for most subjects covered.

  8. Closed the laptop after this and let the ideas settle for a few hours, and a stop at itemwhisper similarly rewarded reflective time, content that benefits from sitting with rather than racing past is the kind I want more of and the kind that this site appears to consistently produce week after week here.

  9. Bookmarking this for later, the kind of resource I want to keep nearby, and a quick look at epicfife confirmed the rest of the site is worth the same treatment, definitely going into my reference folder for the next time the topic comes up at work or in conversation with someone who asks.

  10. Post writing is also a excitement, if you know afterward you can write
    or else it is difficult to write.

  11. A piece that did not waste any of its substance on sales or promotion, and a look at wildorchardcorner continued that pure content focus, sites that resist the urge to monetise every paragraph are increasingly rare and this one has clearly made the editorial choice to keep the writing clean from commercial intrusion which I value highly.

  12. Reading this gave me the rare experience of fully agreeing with all the conclusions, and a stop at basteclay continued that agreement pattern, content that aligns with my existing views without seeming designed to do so is just content that happens to be reasonable and this site reads as reasonable rather than ideological mostly.

  13. Well structured and easy to read, that combination is rarer than people think, and a stop at dreamleafgallery confirmed the same standard runs across the rest of the site, definitely the kind of place I will be coming back to when this topic comes up in conversation later again over the weeks ahead.

  14. Took the time to read the comments on this post too and they were also worth reading, and a stop at eurohilt suggested the community quality matches the content quality, when the conversation around a piece is as good as the piece itself you know you have found a real corner of the internet.

  15. A small thing but the line spacing and font choices made reading this physically pleasant, and a look at basteclay maintained the same careful design, technical choices about typography are part of what makes online reading actually comfortable and this site has clearly invested in the design layer alongside the content layer carefully.

  16. Worth saying this site reads better than most paid newsletters I have tried, and a stop at finkglint confirmed that comparison, the bar for free content is often lower than for paid but this site clears the paid bar consistently and that says something about the editorial approach behind the work being published here regularly.

Deixe um comentário

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