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.

5.768 Comentários

  1. Now considering the post as evidence that careful blog writing is still possible, and a look at everattic extended that evidence, the broader question of whether the modern web can sustain quality writing has obvious empirical answers in sites like this one and seeing them is reassuring even when they remain a minority overall today.

  2. Liked the way the post balanced confidence and humility, and a stop at elmharborcraftcollective maintained the same balance, knowing when to assert and when to acknowledge uncertainty is a sign of mature thinking and the writers here have clearly developed that calibration through what I assume is years of careful work on their craft.

  3. Came in expecting another generic take and got something with actual character instead, and a look at stoneharbormerchantgallery carried that personality forward, finding a distinct voice on a saturated topic is impressive and worth pointing out when it happens because most sites end up sounding identical to their nearest competitors quickly.

  4. A piece that read as if the writer was thinking carefully rather than just typing fluently, and a look at bettershoppinghub 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.

  5. Saving the link for sure, this one is a keeper, and a look at cottonmeadowcraftcollective confirmed I should bookmark the entire site rather than just this page, the consistency across what I have seen so far suggests there is a lot more here worth coming back for soon when I have more time.

  6. Came away with a slightly better mental model of the topic than I started with, and a stop at portmill sharpened that further, content that improves the reader thinking apparatus rather than just dumping facts into it is the rare kind I genuinely value and seek out when I have time to read carefully.

  7. Generally my attention drifts on long posts but this one held it through the end, and a stop at gildedcovecraftcollective earned the same sustained focus, content that defeats my drift tendency is content with substantive pulling power and this site has demonstrated that pulling power across multiple pieces in a session that has now run quite long actually.

  8. Felt mildly happier after reading, which sounds silly but is true, and a look at woodharborvendorroom extended that small mood lift, content that improves rather than degrades my mental state is content I want more of and the cumulative effect of reading sites that lift versus sites that drag is real over time.

  9. A handful of memorable phrases from this one I will probably use later, and a look at everjumbo added a couple more, content that contributes language to my own communication rather than just facts is content with a different kind of utility and this site is providing that linguistic utility consistently across what I read.

  10. Taking the time to read carefully here has been worthwhile for the past hour, and a look at portmill extended the worthwhile reading, the calculation of return on reading time spent is something I do informally and this site has been producing positive returns across multiple sessions during the last week of regular visits and reads.

  11. Honest reaction is that this is the kind of writing I would defend in a conversation about good blog content, and a look at ravengrovetradehall reinforced that, the rare site whose work I would actively recommend rather than just tolerate is the kind I want to support through return visits regularly.

  12. Now feeling the small relief of finding writing that does not condescend, and a stop at alpinecovecraftcollective extended that respect for readers, content that treats its audience as capable adults rather than as people to be managed produces a different reading experience and this site has clearly chosen the respectful approach across all pieces.

  13. Picked something concrete from the post that I will use immediately, and a look at tealcovecraftcollective added another concrete piece, content that produces immediately useful output rather than just abstract appreciation is content that earns its place in my regular rotation without needing any further evaluation from me at this point honestly.

  14. Just one of those reads that left me feeling slightly more capable rather than overwhelmed, and a look at fernharborcommercegallery kept that empowering feel going, the difference between content that builds the reader up and content that intimidates them is huge and this site clearly knows which side of that line to stand.

  15. Вот реально ситуация — когда близкий человек уходит в запой , а просто в тупике. Моя семья с таким столкнулась года два назад . Думал, справлюсь сам — хрен там было. Как показала практика, без врачей и нормального наблюдения не обойтись. Перерыл кучу форумов — сплошной развод . А потом наткнулся на один проверенный вариант. Если ищете где сделать качественное выведение из запоя с госпитализацией — не рискуйте здоровьем человека. В Нижнем Новгороде , кстати , тоже полно левых контор без лицензии. Нормальные контакты ниже по ссылке: клиника лечения зависимостей клиника лечения зависимостей Откровенно говоря, после того как вник в детали, многое стало понятно . И про кодировку от алкоголя в Нижнем Новгороде, и про выезд нарколога на дом . Плюс анонимность — это важно . Рекомендую не тянуть .

  16. Started reading and ended an hour later without realising the time had passed, and a look at alpinecovecraftcollective produced the same time dilation effect, when content makes time feel different the writer has achieved something well beyond the average and this site is producing that experience for me reliably across multiple readings.

  17. Now realising the post solved a small problem I had been carrying for weeks, and a look at ravengrovetradehall extended that problem solving function, content that connects to specific unresolved questions in my own life rather than just providing general interest is content with real practical impact and this site is providing that practical value.

  18. Honestly impressed, did not expect to find this level of care on the topic, and a stop at elmharborcraftcollective cemented the impression, you can tell within the first few paragraphs whether a site is going to be worth the time and this one delivered on that early promise nicely throughout the rest of what I read.

Deixe um comentário

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