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

  1. Compared to the usual results for this kind of search this site stands well above the average, and a quick visit to harborstoneartisanexchange kept the standard high, you can tell within seconds whether a site is going to waste your time or actually deliver and this one clearly delivers without any false starts.

  2. Reading this prompted a small redirection in something I was working on, and a stop at jasperharborartisanexchange extended that redirecting influence, content that affects my actual work rather than just my thinking has the highest practical impact and this site is providing that level of influence for me at a sustainable rate apparently.

  3. Skipped the comments to avoid spoilers and came back later to find them genuinely worth reading, and a stop at etheraisles extended that surprised respect, when the discussion below a post matches the quality of the post itself you have found something special and this site appears to attract that kind of audience.

  4. Reading this gave me confidence to make a decision I had been putting off, and a stop at floraridgeartisanexchange 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.

  5. A welcome reminder that thoughtful writing still happens online, and a look at acornharborcraftcollective 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. Polished and informative without feeling overproduced, that is the sweet spot, and a look at valecoveartisanexchange 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.

  7. Thanks for putting this online without locking it behind email signups or paywalls, and a quick visit to wildorchardcraftcollective kept that open feel going, content that trusts the reader to come back rather than gating access is the kind of approach I will reward with regular return visits over time happily.

  8. Really thankful for posts that respect a reader’s time, this one does, and a quick look at wildorchardcraftcollective was the same, no need to scroll through endless intros just to get to the actual content, that approach alone is enough reason to come back here regularly for the kind of writing offered.

  9. Mobil platform arayışım epey zaman aldı valla. Herkes farklı bir link atıyordu kime güveneceğimi bilemedim. En sonunda sağlam bir kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet indir android 1xbet indir android. Yani anlatmak istediğim şu — mobil versiyonu bütün özellikleri sunuyor.

    dosya boyutu da hafif gerçekten. Kendi deneyimlerimi aktarıyorum size — en güvenilir uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

  10. Going to come back when I have more time to read carefully, the post deserves more than a quick scan, and a stop at cloudcoveartisanexchange reinforced that, this is the kind of site that rewards a slower read which is hard to find in this fast paced corner of the internet but really worthwhile.

  11. Worth flagging that the writing rewarded a second read more than I expected, and a look at hazelharborartisanexchange produced the same second read benefit, content with hidden depths that emerge only on careful rereading is rare in the modern blog space and this site has clearly invested in that level of compositional density throughout.

Deixe um comentário

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