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.

6.213 Comentários

  1. After reading several posts back to back the consistent voice across them is impressive, and a stop at strategyoperations continued that voice consistency, sites that maintain a single coherent voice across many pieces by potentially many writers represent serious editorial discipline and this one has clearly developed the institutional consistency needed for that.

  2. Took me back a step or two on an assumption I had been making, and a stop at fashioncartworld pushed that reconsideration further, writing that gently corrects the reader without being aggressive about it is a rare diplomatic skill and the team here clearly knows how to land critical points without turning readers off.

  3. Worth observing that the post landed without needing a flashy headline to hook attention, and a stop at growthnavigation did the same, content that earns engagement through substance rather than packaging is the kind I trust more deeply and this site has clearly chosen substance as the primary lever for reader engagement throughout.

  4. Felt the post had been quietly polished rather than aggressively styled, and a look at ideabuilderhub confirmed the same understated polish, sites whose quality reveals itself slowly rather than announcing itself loudly are the kind I trust more deeply because the trust is not based on first impressions of marketing but actual substance.

  5. Reading this gave me a small refresher on something I had partially forgotten, and a stop at crystalcovegoodsgallery extended the refresher, content that strengthens existing knowledge rather than just adding new is content with a particular kind of consolidating value and this site is providing that consolidating function across multiple visits.

  6. Started smiling at one paragraph because the writing was just nice, and a look at honeycovevendorroom produced a couple more such moments, prose that produces small spontaneous reactions in the reader is doing more than just transferring information and the writers here are clearly hitting that level fairly consistently throughout pieces.

  7. Worth pointing out that the writer made the topic feel more interesting than I had been expecting, and a look at directioncreatesresults continued that elevation effect, content that improves the apparent quality of its subject through skilled treatment is doing something real and this site has clearly developed that kind of editorial alchemy throughout.

  8. Reading this gave me a small sense of progress on a topic I have been slowly working through, and a stop at flintmeadowmerchantgallery added another step forward, learning happens in small increments across many sources and finding sources that consistently contribute is the actual practical value of careful curation in an information rich world.

  9. Probably the kind of site that should be more widely read than it appears to be, and a look at flintmeadowmerchantgallery reinforced that quiet wish, the gap between a sites quality and its apparent reach is sometimes large and that gap exists for this site in a way that makes me want to mention it more.

  10. Felt the writer respected the topic without being precious about it, and a look at crystalcovegoodsgallery continued that respectful but unfussy treatment, finding the right register for serious topics is hard and this site has clearly figured out how to take the topic seriously while still being readable for casual visitors regularly.

  11. Reading this gave me confidence to make a decision I had been putting off, and a stop at buildwithintelligence reinforced that confidence, content that translates into action in my own life rather than just informing it is content with the highest practical value and this site is generating that action level utility for me lately.

  12. Closed the post with a small satisfied sigh, and a stop at ideasneedclarity produced the same gentle exhale, content that ends well is content that respects the rhythm of reading and the writers here have clearly thought about how their pieces close rather than just trailing off when they run out of things to say.

  13. Quietly enthusiastic about this site after the past few hours of reading, and a stop at momentumplanner extended that enthusiasm, the calibration of enthusiasm to evidence is something I try to maintain and this site has earned a calibrated quiet enthusiasm rather than the loud excitement that usually fades within a day or two of finding something.

Deixe um comentário

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