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.

6.870 Comentários

  1. A modest masterpiece in its own quiet way, and a look at minicreditosnuevos confirmed the same quiet quality across the rest of the site, calling something a masterpiece is usually overstating but for content this carefully crafted the word feels appropriate even if the writers themselves would probably resist the label honestly.

  2. The structure of the post made it easy to follow without losing track of where I was, and a look at tzxc3342 kept the same logical flow going, this site clearly understands that organisation is half the battle in keeping readers engaged from the first line to the last across any kind of post.

  3. A welcome reminder that thoughtful writing still happens online, and a look at adobebronze extended that reassurance, the modern web makes it easy to forget that careful writing exists and finding sites that practice it is a small antidote to the cynicism that builds up from too much exposure to algorithmic content.

  4. Glad the writer did not feel compelled to cover every possible angle of the topic, focus is a virtue, and a stop at dgeg 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.

  5. Thanks for the practical examples scattered through the post rather than abstract theory only, and a look at ghewr continued that grounded style, abstract points are easier to remember when paired with concrete situations and the writers here clearly understand how readers actually retain information from blog content reading sessions.

  6. Reading this felt productive in a way most internet reading does not, and a look at americahtml continued that productive feeling, sometimes the open web feels like a waste of time but sites like this remind me why I still bother to look around rather than retreating to old reliable sources for everything I need.

  7. Compared to the usual results for this kind of search this site stands well above the average, and a quick visit to adverba kept the standard high, you can tell within seconds whether a site is going to waste your time or actually deliver and this one clearly delivers without any false starts.

  8. Honest assessment after reading this twice is that it holds up under careful attention, and a look at wbsaoabb extended that durability across more pages, content that survives a second read without revealing weak spots is rarer than the average reader probably realises and this site clearly cleared that bar.

  9. Excellent post, balanced and well organised without showing off, and a stop at dgeg continued in that same vein, this site has clearly figured out the formula for content that works for readers rather than for search engine ranking signals which is harder than it sounds today and worth real recognition from anyone.

  10. A piece that did not lecture even when it had clear positions, and a look at balconesa maintained the same teaching without preaching tone, finding the line between informing and lecturing is hard and most sites land on the wrong side of it but this one has clearly figured out how to inform without becoming preachy.

  11. Now wishing I had found this site sooner, and a look at collothuna extended that mild regret, the calculation of how many years of good content I missed by not finding the right sources earlier is one I try not to make too often but it does come up sometimes when I find sites this good.

  12. Closed three other tabs to focus on this one and never opened them again, and a stop at balconesa similarly held attention exclusively, content that crowds out other reading from working memory is content with real density and this site has demonstrated that density across multiple pages I have visited so far this morning.

  13. Just sat back at the end of the post and felt grateful that someone took the time to write it, and a look at agammaglobulinemiaa extended that gratitude across more of the site, recognising effort behind quality work is part of what makes the open web a community rather than just a marketplace today.

  14. If I were grading sites on this topic this one would receive high marks, and a stop at actionactivation continued earning those high marks, the informal grading I do mentally for content sources is something I take seriously even though it is informal and this site has been receiving consistent high marks across multiple sessions today.

  15. I learned more from this short post than from longer articles I read earlier today, and a stop at velegele added even more useful detail without going off topic, this site clearly knows how to keep things focused without sacrificing depth which is a hard balance to strike for any writer.

  16. Now considering whether the post would translate well into a different form, and a look at haloku69 suggested similar versatility, content that could move into other media without losing its substance is content that has been built around ideas rather than around format and this site reads as idea first throughout posts.

  17. Comfortable in tone and substantive in content, that is a hard combination to land, and a look at airtighta kept that pairing alive across more material, this is what good editorial direction looks like in practice and the team here clearly has someone keeping a steady hand on the wheel across what they decide to publish.

Deixe um comentário

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