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

  1. twilightpetalmarket twilightpetalmarket

    Just enjoyed the experience without needing to think about why, and a look at twilightpetalmarket kept that effortless feeling going, sometimes the best content is invisible in the sense that you forget you are reading until you reach the end and realise time has passed without you noticing it pass naturally.

  2. xenojet xenojet

    Felt the post had been quietly polished rather than aggressively styled, and a look at xenojet confirmed the same understated polish, sites whose quality reveals itself slowly rather than announcing itself loudly are the kind I trust more deeply because the trust is not based on first impressions of marketing but actual substance.

  3. zingdart zingdart

    Worth saying this site reads better than most paid newsletters I have tried, and a stop at zingdart confirmed that comparison, the bar for free content is often lower than for paid but this site clears the paid bar consistently and that says something about the editorial approach behind the work being published here regularly.

  4. docktone docktone

    Started imagining how I would explain the topic to someone else after reading, and a look at docktone gave me more material for that imagined explanation, content that improves my own ability to discuss a topic is content that has actually transferred knowledge rather than just decorating my screen for a few minutes.

  5. fluxbuild fluxbuild

    A piece that did not try to be timeless and ended up reading as durable anyway, and a look at fluxbuild extended that durable feel, content that stays useful past its publication date without straining for permanence is content that ages well and this site has the kind of evergreen quality that I value highly today.

  6. zingdart zingdart

    Bookmark earned, share earned, return visit earned, all from one reading session, and a look at zingdart did the same, the trifecta of bookmark and share and return is rare in a single visit and represents the highest level of engagement I tend to offer any piece of online content these days here.

  7. how do you place a bet on the grand national​

    Have a look at my webpage: horse racing non runners today uk​ (Maggie)

  8. sleekgain sleekgain

    Felt the post had been written without using a single buzzword, and a look at sleekgain continued that clean vocabulary, content free of jargon and trendy phrases reads better and ages better and this site has clearly committed to a vocabulary that will not feel dated in three years which is impressive editorially.

  9. Dontebibia Dontebibia

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

  10. logicarc logicarc

    Started believing the writer knew the topic deeply by about the second paragraph, and a look at logicarc reinforced that confidence, the speed at which a writer establishes credibility through their writing is a useful quality signal and this writer establishes it quickly and quietly without resorting to credential dropping or self promotion.

  11. volttray volttray

    Beats most of the alternatives on the topic by a noticeable margin, and a look at volttray did not change that at all, this is one of the better corners of the open internet for this kind of content and I am glad I clicked through rather than skipping past quickly like I usually do.

  12. urbanfernmarket urbanfernmarket

    Just want to recognise that someone clearly cared about how this turned out, and a look at urbanfernmarket confirmed that care extends across the broader site, you can feel the difference between content shipped to hit a deadline and content released because the writer was actually proud of the result for once.

  13. velvetshorecollective velvetshorecollective

    Felt the writer respected the topic without being precious about it, and a look at velvetshorecollective continued that respectful but unfussy treatment, finding the right register for serious topics is hard and this site has clearly figured out how to take the topic seriously while still being readable for casual visitors regularly.

Deixe um comentário

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