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.

3.368 Comentários

  1. Took a quick scan first and then went back to read properly because the post deserved it, and a stop at bravofarm kept me reading carefully too, the kind of writing that earns a slower second pass rather than getting skimmed and forgotten is something I value highly when I happen to find it.

  2. Roberttig Roberttig

    Важное преимущество услуги — анонимность. Информация о пациента, обращении, адрес, диагноз, лечение, консультация, стоимость, препараты и другие данные не передаются третьим лицам. Нажимая кнопку «отправить заявку», вы соглашаетесь с пользовательским соглашением, политикой обработки персональных данных и политикой конфиденциальности сайта.
    Детальнее – вызвать нарколога на дом

  3. A genuine pleasure to find a site that publishes at a sustainable cadence rather than chasing the daily content treadmill, and a look at wildridgeattic confirmed the careful publication rhythm, sites that prioritise quality over frequency are rare and this one has clearly chosen the slower pace which I appreciate as a reader.

  4. Really appreciate that the writer did not assume I would read every other related post first, and a look at freshcluster kept that self contained feel going where each piece can stand alone, accessibility for new readers is a sign of generous editorial thinking and this site has clearly invested in that approach.

  5. Now realising the post solved a small problem I had been carrying for weeks, and a look at freshcluster 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.

  6. Really appreciate the confidence to make a clear point rather than hedging everything, and a quick visit to irisbureau maintained the same direct stance, writing that takes positions rather than equivocating is more useful even when the positions are debatable because at least the reader has something to react to clearly.

  7. Decided not to comment because the post said what needed saying, and a stop at discoverbestoffers continued that complete feel, content that does not invite obvious additions or corrections from readers is content that has been carefully considered and this site appears to consistently produce pieces that satisfy rather than provoke unnecessary follow ups.

  8. Closed my email tab so I could read this without interruption, and a stop at flareaisle earned the same protected attention, when content is good enough to defend against the usual digital distractions you know it deserves better than the half attention most online reading gets in a typical busy day.

  9. Appreciate how nothing here feels copied or pieced together from other places, the voice is consistent and the tone stays human, and after I checked autumnmistemporium I noticed the same style holds, which is a small detail but it makes the whole experience feel personal rather than like another generic site.

  10. Started taking notes about halfway through because the points were stacking up, and a look at irisbureau added enough material that my notes file grew further, content that demands note taking from a passive reader is content with substance and the writers here are clearly producing that kind of work consistently across topics.

  11. Closed my email tab so I could read this without interruption, and a stop at shopthelatestdeals earned the same protected attention, when content is good enough to defend against the usual digital distractions you know it deserves better than the half attention most online reading gets in a typical busy day.

  12. Thank you for the genuine effort here, it shows in every paragraph and not just the headline, and after my visit to oceanleafcollections I was sure this site cares about getting things right rather than chasing clicks, which is the main reason I will come back later this week to read more.

  13. The overall feel of the post was professional without being stuffy, and a look at bravoparish kept that approachable expertise going, finding the right register for technical content is hard but this site has clearly figured out how to sound knowledgeable without slipping into that distant lecturing tone that loses readers in droves every time.

  14. Honestly this kind of writing is why I still bother to read independent sites, and a look at brightcollectionhub extended that broader reflection, the few sites that justify continued attention to non algorithmic content are sites like this one and finding them periodically is enough to keep my reading habits oriented toward independent rather than aggregated content.

  15. Worth marking the moment when reading this clicked into something useful for my own work, and a look at brightpeakharbor extended that practical click, content that connects to my actual life rather than just being interesting is content with the highest kind of value and this site is generating that connection at a high rate.

  16. Reading this on the train into work was a better use of the commute than my usual choices, and a stop at deepbrookcorner extended that commute reading well, content that improves transit time rather than just filling it is content with practical benefit and this site has earned its place in my morning commute reading rotation.

Deixe um comentário

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