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

  1. Useful read, especially because the writer did not assume too much background from the reader, and a quick look at everhollowbazaar continued in the same way, a thoughtful site that meets people where they are which is something the modern web could use a lot more of for both casual and serious readers.

  2. Just sat back at the end of the post and felt grateful that someone took the time to write it, and a look at everfieldhome extended that gratitude across more of the site, recognising effort behind quality work is part of what makes the open web a community rather than just a marketplace today.

  3. Thanks for sharing this with the open internet rather than locking it behind a paywall like so many sites do now, and a stop at everwoodsupply kept the same vibe going, generous helpful and clearly written by someone who actually wants people to learn from it rather than just charge them.

  4. Bookmark added in three places to make sure I do not lose the link, and a look at futureharborhome got the same redundant treatment, sites I am afraid to lose are the rare keepers and this is clearly one of them based on what I have read so far across this and a couple of related posts.

  5. Someone necessarily lend a hand to make seriously posts I would state.
    That is the very first time I frequented your
    website page and so far? I amazed with the research you made
    to make this actual post incredible. Fantastic process!

  6. Felt the writer did the homework before publishing, the references hold up, and a look at everfieldhome continued that documented care, content with traceable claims rather than vague assertions is the kind I trust and the lack of bald assertion in this post is one of its quietly impressive qualities for me.

  7. Considered as a whole this site has developed a coherent point of view that comes through in individual pieces, and a look at futureharborhome continued displaying that coherence, sites with a unified perspective rather than a grab bag of takes are sites with editorial maturity and this one has clearly developed that maturity through years of work.

  8. Worth recommending broadly to anyone who reads on the topic, and a look at globalcrestfinds only confirms that, the rare combination of accessibility and depth in this site makes it suitable for both newcomers and people who already know the area which is hard to pull off in any blog format today and rarely managed.

  9. discoverfindsmarket discoverfindsmarket

    Honestly this was a good read, no jargon and no padding, and a short look at discoverfindsmarket kept that same feel going which I really appreciated, the writer clearly knows the topic well enough to explain it without hiding behind big words or filler that often gets used to seem clever.

  10. Nice blog here! Also your web site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as fast as yours lol

  11. DavidTip DavidTip

    Важно не ждать, когда состояние пациента станет критическим. Алкоголизма, наркомании и других форм зависимости часто стесняются, но промедление может привести к осложнениям, депрессии, агрессии, нарушению работы органов, тяжелой интоксикации и риску для жизни человека.
    Выяснить больше – нарколог на дом казань

  12. Did not expect much when I clicked through but ended up reading the whole thing carefully, and a stop at freshfashionoutlet kept that engagement going, sometimes the unassuming sites turn out to deliver more than the flashy ones which is something I have learned to look out for over time online lately and across topics.

Deixe um comentário

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