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.062 Comentários

  1. Cuts through the usual marketing fluff that dominates this topic online, and a stop at startwithpurpose kept the same clean approach going, this is the kind of writing that respects the reader’s time rather than wasting it on repetitive setups before finally getting to the point at hand which is what most sites do.

  2. Now thinking the topic is more interesting than I had given it credit for, and a stop at exploreideaswithpurpose continued that elevated interest, content that revives my curiosity about subjects I had set aside is doing genuine work in the structure of my interests and this site is providing that revivifying effect today actually.

  3. Reading this in the gap between work projects was a small but meaningful break, and a stop at findyourgrowthlane extended that gentle reset, content that provides genuine refreshment rather than just distraction during work breaks is content with a particular kind of utility and this site fits that role for me reliably during work days.

  4. Without comparing too aggressively to other sources this one stands out for the right reasons, and a look at learnandscale continued that distinctive quality, content that distinguishes itself through substance rather than style tricks is content with lasting differentiation and this site has clearly chosen substance based differentiation as its core editorial strategy.

  5. A welcome reminder that thoughtful writing still happens online, and a look at explorefreshgrowthideas 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.

  6. Reading this prompted me to dig into a related topic later, and a stop at buildsustainablemomentum provided some of the starting points for that follow up reading, content that triggers further exploration rather than satisfying curiosity completely is content with real generative energy and this site has plenty of that energy throughout it.

  7. Stayed longer than planned because each section earned the next, and a look at startnextlevelgrowth kept that pulling effect going across more pages, the kind of subtle pull that good writing exerts on attention is something I find harder and harder to resist when I encounter it on the open web today.

  8. Probably worth setting aside a longer block to read more carefully than I can right now, and a stop at exploreideaswithpurpose confirmed the longer block plan, the impulse to schedule dedicated time for a sites archive is itself a measure of trust and this site has earned that scheduling impulse from me clearly today actually.

  9. Reading this gave me a small jolt of recognition for an experience I thought was just mine, and a stop at startthinkingclearly produced more such jolts, content that universalises private experiences without flattening them is doing genuinely useful work and this site is providing that recognition function for me reliably across topics I read.

  10. Really appreciate that the writer did not assume I would read every other related post first, and a look at inobrisk 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.

  11. Reading this confirmed that my time researching the topic in other places had not been wasted, and a stop at explorefreshthinkingnow extended the confirmation, when independent sources agree that is a useful signal and this site is one of the more reliable sources I have found for cross checking what I read elsewhere on similar subjects.

  12. Now setting aside time on my next free afternoon to read more from the archives, and a stop at startnextlevelgrowth confirmed that time will be well spent, the rare site whose archive deserves a dedicated reading session rather than just casual sampling is the kind of resource worth scheduling around and this one qualifies clearly.

Deixe um comentário

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