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.

4.313 Comentários

  1. Now planning to write about the topic myself eventually using this post as a reference, and a look at mallivo would also serve in that future piece, content that becomes raw material for my own writing rather than just informing my reading is content with multiplicative value and this site is generating that multiplicative effect.

  2. Closed my email tab so I could read this without interruption, and a stop at nagapinto 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.

  3. Useful information presented in a way that does not feel like a sales pitch, that is what I appreciated most, and a stop at modloop was the same, no upsell and no fake urgency just steady content laid out properly for someone trying to actually learn from it rather than just be sold to.

  4. Honestly impressed, did not expect to find this level of care on the topic, and a stop at trivent 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.

  5. A piece that did not require external context to follow, and a look at poppymedal maintained the same self contained quality, content that stands alone without forcing readers to chase prerequisites is more accessible and this site has clearly thought about how each piece can serve a fresh visitor rather than only existing members.

  6. Worth recognising that the post handled a familiar topic without reaching for any of the obvious hot takes, and a stop at cartvilo continued that fresh treatment, sites that find new angles on subjects others have exhausted are sites worth following carefully and this one has clearly developed that exploratory instinct through patient practice.

  7. Well structured and easy to read, that combination is rarer than people think, and a stop at padreledge confirmed the same standard runs across the rest of the site, definitely the kind of place I will be coming back to when this topic comes up in conversation later again over the weeks ahead.

  8. More original than the recycled takes I keep finding on the topic elsewhere, and a quick look at nagapinto confirmed it, the kind of site that has its own voice rather than echoing whatever is trending which makes it stand out as a refreshing change from the usual rotation of generic content I see daily.

  9. Bookmark earned, calendar reminder set, share queued, all from one good post, and a look at millpeach did the same, when a single reading session triggers multiple downstream actions you know the content has actually moved me beyond the page and this site is moving me at that higher level reliably.

  10. Reading this prompted me to subscribe to my first newsletter in months, and a stop at cartvilo confirmed the subscribe was the right call, content that earns a newsletter signup is content that has cleared a higher trust bar than a casual visit and this site has clearly earned that level of commitment from me.

  11. Felt the post had been written without looking over its shoulder, and a look at pianoledge continued that confident posture, content written for its own sake rather than against imagined critics has a different quality and this site reads as written from a place of confidence rather than defensive justification of every claim.

  12. Took a screenshot of one section to come back to later, and a stop at framegable 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.

  13. The overall feel of the post was professional without being stuffy, and a look at purplemilk 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.

Deixe um comentário

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