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.

7.169 Comentários

  1. Granted I am giving this site more credit than I usually give new finds, and a look at dailyneedsstore continued earning that credit, the calibration of how much trust to extend after limited exposure is something I do carefully and this site has earned more trust on shorter exposure than most due to consistent quality across.

  2. Bookmark moved to my permanent reference folder rather than the casual maybe later folder, and a look at kettleharborcommercegallery earned the same upgrade, the distinction between casual interest and lasting reference is something I track carefully and very few sites cross that threshold but this one did so without much effort apparently.

  3. Grateful for posts like this one, they remind me there are still places online run by people who care about quality, and a look at futurecartcorner reflected the same standards, you can tell the difference between content made for readers and content made just for search engines today and this is the former.

  4. If the topic interests you at all this is a place to spend time, and a look at pearlharborvendorparlor reinforced that recommendation, the broader question of where to invest topical reading time is one this site answers convincingly through the consistent quality across multiple pieces I have sampled during the current reading session today.

  5. Took a screenshot of one section to come back to later, and a stop at walnutharborvendorparlor prompted another saved tab, the urge to capture and revisit specific pieces of content is something I rarely feel but when I do it tells me the work is worth more than the average passing read for sure.

  6. Felt like the post had been edited rather than just drafted and published, and a stop at futurecartcorner suggested the same care across the site, the difference between edited and unedited content is enormous for the reader and this site has clearly invested in the editing pass that most blogs skip entirely which really does show up.

  7. A piece that did exactly what it promised in the headline without overshooting or underdelivering, and a look at salutesyrup continued that calibration, alignment between promise and delivery is a basic editorial virtue that many sites fail at and this site has clearly mastered the matching of expectation and substance throughout pieces.

  8. Took longer than expected to finish because I kept stopping to think, and a stop at swordtunic did the same to me, content that provokes thought rather than just delivering information is in a different category and the team here is clearly working at that higher level rather than just cranking out posts.

  9. Solid endorsement from me, the writing earns it, and a look at hullgale continues to earn it across the broader site too, the kind of operation that maintains quality across many pages rather than just one viral post is a sign of serious commitment and that is what I see here clearly across what I read.

  10. Closed the laptop after this and let the ideas settle for a few hours, and a stop at seacovecraftcollective 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.

  11. Looking at this objectively the editorial quality is hard to deny even setting aside personal taste, and a stop at deoblob maintained the same objective quality, the gap between what I personally enjoy and what is objectively well crafted exists and this site clears both bars simultaneously which is rarer than it sounds.

  12. Glad the writer did not feel the need to argue with imaginary critics in the post itself, and a stop at villageswan kept the same focused approach going, defensive writing wastes the reader time and confidence on positions that did not need defending and this post has clearly avoided that common failure.

  13. Picked up on several small touches that suggest a careful editor, and a look at aroarch suggested the same hand at work across the broader site, editorial consistency at a granular level is one of the strongest signs that an operation is serious rather than just hobbyist and this site reads as serious throughout.

  14. Looking back on this reading session it stands as one of the better ones recently, and a look at lanternorchardmerchantgallery extended that ranking, the informal ranking of reading sessions against each other is something I do mentally and this session ranks high largely because of this site and a couple of related pages here.

  15. A piece that read as if the writer was thinking carefully rather than just typing fluently, and a look at deoblob continued that considered quality, the difference between fluent typing and careful thinking shows up in writing and this site reads as the product of thought rather than just the product of language fluency apparently.

Deixe um comentário

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