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.

8.757 Comentários

  1. Слушайте кто сталкивался Брат потерял человеческий облик Дети боятся заходить в комнату В диспансер тащить — последнее дело Короче, единственные кто взялся за безнадёжный случай — вывод из запоя самара стационар с палатой Капельницы и уколы по схеме В общем, не потеряйте контакты — вывод из запоя в стационаре вывод из запоя в стационаре Звоните прямо сейчас Перешлите тем кто в беде

  2. Worth every minute of the time spent reading, and a stop at easydigitalretail extends that value across more pages, in a media environment where most content is engineered to waste attention this site stands out by treating reader time as something valuable rather than something to be exploited and stretched as far as possible.

  3. A memorable post for me on a topic I had thought I was tired of, and a look at discovernewdirections suggested the same site can refresh other tired topics, sites that can revive my interest in subjects I had written off as exhausted are doing rare work and this one is clearly doing that for me today.

  4. Polished and informative without feeling overproduced, that is the sweet spot, and a look at learnfromexpertinsights hit it again, you can tell when a site has been built with care versus thrown together for the sake of having something to put online and this is clearly the former approach taken by the team.

  5. A piece that demonstrated competence without performing it, and a look at digitalbuyingexperience maintained the same self assured but unshowy register, the gap between competence and performance of competence is one I track and this site has clearly chosen to demonstrate rather than perform which I find much more persuasive as a reader.

  6. Now planning to recommend this site in a context where my recommendations are taken seriously, and a stop at trustedmarketrelationship confirmed I should make that recommendation soon, the small but real act of recommending content into spaces where my taste matters is something I take seriously and this site is worth the recommendation.

Deixe um comentário

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