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.

3.957 Comentários

  1. Thanks for laying this out in a way that someone newer to the topic can follow, and a stop at ethicalglobalmarket kept that accessibility going, writing that meets readers at different experience levels without condescending is hard to do well and the writers here have clearly thought about who they are writing for.

  2. Reading this in a moment of low energy still kept my attention, and a stop at balticarrow continued that engagement under suboptimal conditions, content that survives the reader being tired is content with extra reserves of pull and this site has the kind of writing that holds up even when I am not at my reading best.

  3. Comfortable reading experience throughout, no jarring tone shifts and no awkward formatting, and a look at croccocoa kept that smooth feel going, the kind of editorial polish that goes unnoticed when present but glaring when absent is something this site has clearly invested in across the broader content as well which deserves recognition.

  4. Honest take is that this was better than I expected when I clicked through, and a look at bowbotany reinforced that, the bar for online content has dropped so much that finding something thoughtful and well constructed feels almost noteworthy now which says more about the average than about this site itself.

  5. Stands out for actually being useful instead of just being long, and a look at consciousconsumerhub kept that going, length without value is the default mode of most blogs these days but this site has clearly chosen a different path which I respect a lot as a reader who values careful editing decisions like that.

  6. More original than the recycled takes I keep finding on the topic elsewhere, and a quick look at intentionalclickpingcollective confirmed it, the kind of site that has its own voice rather than echoing whatever is trending which makes it stand out as a refreshing change from the usual rotation of generic content I see daily.

Deixe um comentário

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