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.

4.811 Comentários

  1. Louielar Louielar

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

  2. Came in expecting another generic take and got something with actual character instead, and a look at startclearthinking carried that personality forward, finding a distinct voice on a saturated topic is impressive and worth pointing out when it happens because most sites end up sounding identical to their nearest competitors quickly.

  3. WayneDah WayneDah

    В данной статье рассматриваются физиологические и эмоциональные аспекты зависимости. Мы обсудим, как организм реагирует на зависимое поведение, и какие методы помогают восстановить здоровье и внутреннее равновесие.
    Доступ к полной версии – кодировка sit mst

  4. Ended up here on a wandering afternoon and was glad I stayed for the read, and a stop at ixaqua extended the wandering into a proper exploration of the site, the kind of place that rewards aimless clicking with something genuinely interesting rather than the shallow content that mostly populates the modern open web.

  5. Anyone curious about this topic would do well to start here, the foundation laid is solid, and a stop at discoverbetterchoices would round out their understanding nicely, this is the kind of resource I would point a friend toward without hesitation if they asked me where to begin learning about anything in this area.

  6. AllenFaw AllenFaw

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

  7. Stayed longer than planned because each section earned the next, and a look at arobell kept that pulling effect going across more pages, the kind of subtle pull that good writing exerts on attention is something I find harder and harder to resist when I encounter it on the open web today.

  8. ElwoodNug ElwoodNug

    В этой статье мы говорим о важности поддержки в процессе выздоровления. Рассматриваются семьи, группы поддержки, специалисты и онлайн-ресурсы, которые могут сыграть решающую роль в избавлении от зависимости.
    Узнайте всю правду – tver clinica plus

  9. Probably one of the more reliable sources I have found for this kind of careful coverage, and a look at thrashurge reinforced the reliability, the small group of sources I would describe as reliable for a given topic is curated carefully and this site has earned a place in that small group through consistent performance.

  10. Grateful for posts like this one, they remind me there are still places online run by people who care about quality, and a look at ixaqua reflected the same standards, you can tell the difference between content made for readers and content made just for search engines today and this is the former.

  11. Closed the laptop after this and let the ideas settle for a few hours, and a stop at topaztower similarly rewarded reflective time, content that benefits from sitting with rather than racing past is the kind I want more of and the kind that this site appears to consistently produce week after week here.

Deixe um comentário

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