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.879 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.

  18. Worth your time, that is the simplest endorsement I can give, and a stop at apiculatea extends that endorsement across the rest of the site, this is one of those increasingly rare places that delivers on what it promises rather than over selling the content and under delivering on substance every time which I find frustrating elsewhere.

  19. Reading this prompted a small note in my reference file, and a stop at nandh prompted another, the rare site that contributes useful nuggets to my own working knowledge rather than just consuming my attention is worth the time investment many times over compared to the usual pile of forgettable scroll content.

  20. Thanks for the breakdown, it gave me a clearer picture of something I had been confused about for a while now, and a stop at apiculatea closed the remaining gaps in my understanding nicely, no need to hunt around twenty other articles to put the pieces together which is a real time saver.

  21. Just wanted to drop a quick note saying this was a useful read on a topic I have been circling, no fluff, and a stop at nandh added a few extra points that fit the same simple style which makes the whole site feel coherent rather than thrown together by many different writers with different goals.

  22. May I simply just say what a comfort to discover someone who genuinely knows what they are discussing on the net. You actually understand how to bring an issue to light and make it important. More people need to look at this and understand this side of the story. I can’t believe you’re not more popular since you surely have the gift.

  23. Je cherchais une application mobile de qualité pour mes paris. Télécharger un fichier sûr devenait un vrai casse-tête chinois. Après avoir suivi les étapes dans le bon ordre, tout a fonctionné. J’ai finalement trouvé la bonne source et je voulais vous partager tous les détails, vous pouvez consulter les informations à jour ici: 1xbet gratuit 1xbet gratuit. Voilà, pour être clair net et précis — après l’avoir installée, j’étais vraiment bluffé.

    l’installation était rapide comme l’éclair. J’ai comparé plusieurs applis mais celle-ci est la meilleure — c’est sans doute l’application la plus performante du marché. J’espère que vous serez aussi conquis que moi…

  24. Je cherchais une application fiable pour mon téléphone. Télécharger un fichier sûr était devenu un vrai casse-tête. Finalement, j’ai pris le temps d’analyser tous les détails techniques. J’ai finalement trouvé la bonne source et je voulais vous partager tous les détails, vous pouvez consulter les informations à jour ici: 1xbet.apk http://mameauto.com. Voilà, pour être clair — l’application mobile fonctionne parfaitement bien.

    l’installation était simple et rapide, pas de souci à vous faire. Pour être honnête, c’est la plus fiable que j’ai trouvée — croyez-moi, vous ne serez pas déçus, essayez-la. Je vous souhaite bonne chance et beaucoup de gains…

  25. 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 administrativea 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.

Deixe um comentário

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