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

  1. Now planning to come back when I have the right kind of attention to read carefully, and a stop at growwithsteadyintent reinforced that plan, choosing the right moment to read certain content is a quiet form of respect for the work and this site is generating those careful planning behaviours from me consistently as a reader.

  2. Decided to set a calendar reminder to revisit, and a stop at findyourstrongdirection extended that revisit list, calendar entries for content are a level of commitment I rarely make but when I do they signal a higher regard than a simple bookmark and this site has earned that calendar tier of relationship from me today.

  3. Probably going to mention this site in a write up I am working on later this month, and a stop at startmovingstrategicallynow provided more material for that potential mention, content worth referencing in my own published work rather than just personal reading is content with the highest endorsement level and this site has earned that endorsement.

  4. A piece that did exactly what it promised in the headline without overshooting or underdelivering, and a look at learnandadvancepath continued that calibration, alignment between promise and delivery is a basic editorial virtue that many sites fail at and this site has clearly mastered the matching of expectation and substance throughout pieces.

  5. Now noticing that the post never raised its voice even when making a strong point, and a look at createimpactplanningframework continued that calm volume, content that can make important points without resorting to typographic emphasis or emotional appeal is content that trusts its substance to do the work and this site has that confidence consistently.

  6. Reading this post made me realise I had been settling for lower quality elsewhere, and a look at startyourjourneynow extended that recalibration, content that exposes how much I had been accepting in adjacent sources is content with calibrating effect on my standards and this site is performing that calibration function across topics for me reliably.

  7. Refreshing tone compared to the dry corporate posts on similar topics, and a stop at startprogressnow carried that personality through nicely, you can tell when a real person is behind the writing versus a content team chasing metrics and this site definitely falls into the former category clearly across what I have seen.

  8. Generally I do not leave comments but this post merits a small note, and a stop at growwithintentionalsteps extended that comment worthy quality, the urge to actively contribute to a sites community rather than passively consume from it is something specific content provokes and this site has provoked that engagement urge from me today.

  9. Felt the writer respected the topic without being precious about it, and a look at findyourstrongdirection 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.

  10. Reading this with a fresh mind in the morning brought out details I might have missed in the afternoon, and a stop at exploreuntappedpotential earned the same fresh attention, content that rewards being read at full attention rather than at energy lows is content with real density and this site has that density consistently.

  11. Once you find a site like this the search for similar voices begins, and a look at createprogressplanning extended the search energy, finding a high quality reference point makes the gap between it and adjacent sources visible in a way it was not before and this site has provided that high reference point across multiple recent visits.

  12. Comfortable read, finished it without realising how much time had passed, and a look at createbetterpaths pulled me into more pages the same way, the absence of friction in good content lets time disappear and that is one of the highest compliments I can pay any piece of writing I find online during a regular search session.

  13. A welcome contrast to the loud takes that have dominated my feed lately, and a look at seohive extended that calm voice, content that arrives without yelling has become unusual in the modern attention economy and this site is one of the few places I have found that consistently delivers without raising its voice.

  14. Speaking carefully because I do not want to overstate things this site is genuinely above average across multiple measurements, and a stop at discovernewfocus continued the above average performance, the calibration of judgement against potential overstatement is something I take seriously and this site clears the higher bar even after that calibration applies.

  15. Generally I do not leave comments but this post merits a small note, and a stop at growwithintentionalsteps extended that comment worthy quality, the urge to actively contribute to a sites community rather than passively consume from it is something specific content provokes and this site has provoked that engagement urge from me today.

  16. Worth flagging this post as worth a careful read rather than a casual skim, and a stop at createimpactplanningframework earned the same careful approach, the few sites that warrant slower reading are sites I now treat differently from the daily content stream and this one has clearly moved into that elevated treatment category.

  17. Horacedus Horacedus

    Learned something from this without having to dig through layers of fluff, and a stop at flareaisle added a bit more context that helped tie things together for me, definitely a useful corner of the internet for anyone who wants real information without the usual marketing nonsense around it that often ruins similar pages.

  18. Came in tired from a long day and the writing held my attention anyway, and a stop at startprogressnow kept that going, content that can engage a fatigued reader is doing something right because most online reading happens in suboptimal conditions like that one and quality content adapts to it without complaint.

Deixe um comentário

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