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.

8.945 Comentários

  1. Всем привет из северной столицы Отец не встаёт с кровати Дети боятся даже подходить Скорая отказывается выезжать Короче, врачи стационара реально помогли — вывод из запоя стационар с круглосуточным наблюдением Выписали через 4 дня здоровым В общем, не потеряйте контакты — стационар вывод из запоя стационар вывод из запоя Звоните прямо сейчас Перешлите тем кто в такой же беде

  2. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  3. Всем привет из Нижнего Брат снова сорвался Родственники не знают что делать В больницу тащить страшно Короче, врачи вытащили с того света — быстрый вывод из запоя в стационаре за 3 дня Положили в палату В общем, жмите чтобы сохранить — вывод из запоя в стационаре наркологии вывод из запоя в стационаре наркологии Стационар — это реальный выход Перешлите тем кто в такой же ситуации

  4. Здорова, народ А на работу через пару часов Поилки и таблетки не помогают Короче, единственное что реально спасает — капельница от похмелья на дому срочно Через час состояние нормализовалось В общем, вся инфа по ссылке — откапаться с похмелья цена воронеж https://kapelnicza-ot-pokhmelya-voronezh-ges.ru Не мучайтесь рассолами Перешлите тем кто в такой же ситуации

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

  6. Доброго вечера После вчерашнего вообще никак Организм просто отказывается работать Короче, нашел реально работающий способ — капельница от похмелья быстрый результат Голова прошла и тошнота ушла В общем, вся инфа по ссылке — сколько стоит прокапать от алкоголизма https://kapelnicza-ot-pokhmelya-voronezh-ges.ru Не мучайтесь рассолами Перешлите тем кто в такой же ситуации

  7. Reading this in the morning set a good tone for the day, and a quick visit to nobletrustnetwork kept that good tone going, content can do that sometimes when it hits the right notes and finding sites that consistently strike that tone is something I have learned to recognise and reward with regular visits.

  8. Honestly the simplicity of the explanation made the topic click for me in a way other writeups had not, and a look at forwardthinkinghub continued that clarity into related areas, when a writer gets the level of explanation right the reader does the heavy lifting themselves and the post just enables it.

  9. Здорово, народ Тошнит, трясёт, сил нет Рассол уже не лезет Короче, нашел реально работающий способ — капельница от похмелья недорого и качественно Голова прошла и тошнота ушла В общем, телефон и цены тут — прокапать после тяжелого похмелья телефон воронеж https://kapelnicza-ot-pokhmelya-voronezh-mnb.ru Звоните прямо сейчас Перешлите тем кто в такой же ситуации

  10. High quality writing, no marketing speak and no buzzwords that mean nothing, and a stop at nobletrustnetwork kept that going, simple direct content that actually communicates something is harder to find than it should be and this is one of the rare places that gets it right consistently across many different posts.

  11. Салют, Воронеж Жесть после вчерашнего Рассол уже не лезет Короче, нашел реально работающий способ — капельница от похмелья клиника на дому Через час состояние нормализовалось В общем, телефон и цены тут — прокапывание на дому https://kapelnicza-ot-pokhmelya-voronezh-mnb.ru Не мучайтесь рассолами Перешлите тем кто в такой же ситуации

  12. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my newest twitter updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

  13. Came here from another site and ended up exploring much further than I planned, and a look at ideaflowpath only encouraged more exploration, the kind of place where one click leads to another not through manipulative design but through genuinely interesting content is rare and worth highlighting when found like this somewhere on the open internet.

  14. Glad the writer did not feel compelled to cover every possible angle of the topic, focus is a virtue, and a stop at directionalplanninglab reflected the same disciplined scope, knowing what to leave out is half of what makes good writing good and this post has clearly been edited with that principle in mind.

  15. Considered alongside other sources I have been reading this one consistently rises to the top, and a stop at alliancecorebond maintained that top ranking, the informal ongoing comparison between sources is something I do whenever reading on a topic and this site keeps coming out near the top of those comparisons over many sessions.

  16. A genuine pleasure to find a site that publishes at a sustainable cadence rather than chasing the daily content treadmill, and a look at intentionalmomentum confirmed the careful publication rhythm, sites that prioritise quality over frequency are rare and this one has clearly chosen the slower pace which I appreciate as a reader.

Deixe um comentário

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