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.

2.416 Comentários

  1. A particular kind of restraint shows up in the writing, and a look at createbettertomorrow maintained the same restraint across pages, knowing what not to say is just as important as knowing what to say and this site has clearly developed strong instincts on both sides of that editorial line throughout pieces I have read.

  2. A piece that demonstrated competence without performing it, and a look at linkmotion 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.

  3. KennethBrode KennethBrode

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

  4. Walked away with a clearer head than I had before reading this, and a quick visit to leadcipher only sharpened that, the writing has a way of cutting through the noise that surrounds most topics online which is something I will definitely remember the next time I am searching for an answer to anything.

  5. Picked up several practical tips that I plan to try out this week, and a look at fashionmarketplace added a few more I will be testing alongside, content with practical hooks that connect to my actual life is the kind that earns my repeat attention rather than the merely interesting that I forget within a day.

  6. Reading carefully here has reminded me what reading carefully feels like, and a look at linkchart extended that reminder, the experience of careful reading versus skimming is different in ways I had partially forgotten and this site has clearly refreshed my memory of what attention feels like when content rewards it consistently.

  7. Appreciated how the writer anticipated the questions a reader might have along the way, and a stop at adcrest continued that thoughtful approach, you can tell when content has been edited with the reader in mind versus just published as a first draft and this is clearly the former approach across what I read.

  8. Reading this with a fresh mind in the morning brought out details I might have missed in the afternoon, and a stop at leadquest earned the same fresh attention, content that rewards being read at full attention rather than at energy lows is content with real density and this site has that density consistently.

  9. Time spent here today felt productive in the way that good reading sessions sometimes do, and a stop at budgetfriendlypicks extended that productive feeling across the rest of the morning, the difference between productive reading and merely passing time is real and this site is consistently on the productive side for me lately.

  10. Useful reading material, the kind I can hand off to someone newer to the topic without worrying about confusing them, and a quick look at discoverandbuy confirmed the same beginner friendly tone runs throughout the site which is great for sharing with people just starting their learning journey on this particular topic.

  11. Easy to recommend, the content speaks for itself without needing additional praise from me, and a stop at linkmotive only adds more reasons to send people this way, the kind of generous resource that benefits its readers without demanding anything in return is increasingly rare and worth recognising clearly today across the broader open internet.

  12. Now understanding why someone recommended this site to me a while back, and a stop at budgetfriendlypicks explained the recommendation, sometimes recommendations make sense only after experience and this site has finally clicked into place as the kind of resource I now understand was being recommended for sound editorial reasons by my friend.

  13. If I am being honest this is the kind of site I quietly hope my own work will someday resemble, and a stop at grabpeak extended that aspirational feeling, finding work that models what I want to produce is part of why I read carefully and this site has been performing that modelling function for me lately consistently.

  14. Reading this prompted me to dig into a related topic later, and a stop at leadblaze provided some of the starting points for that follow up reading, content that triggers further exploration rather than satisfying curiosity completely is content with real generative energy and this site has plenty of that energy throughout it.

  15. TobiasCed TobiasCed

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

Deixe um comentário

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