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

  1. I’m really enjoying the design and layout of your site.
    It’s a very easy on the eyes which makes it much more enjoyable for me to come
    here and visit more often. Did you hire out a designer to create your theme?
    Fantastic work!

  2. Felt the post handled a sensitive angle of the topic with appropriate care, and a look at gemcoasts extended that careful handling across related material, sites that can navigate delicate territory without causing damage are rare and require a level of judgement that comes from experience rather than from following any clear playbook.

  3. Reading this as part of my evening winding down routine fit perfectly, and a stop at modernartisanmarketplace extended the wind down nicely, content that calms rather than agitates is what I want at the end of the day and this site provides that calming reading experience reliably which is increasingly rare across the modern web.

  4. Honestly the simplicity of the explanation made the topic click for me in a way other writeups had not, and a look at larkcliffs 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.

  5. Considered as a whole this site has developed a coherent point of view that comes through in individual pieces, and a look at oceanhaven 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.

  6. Felt the post had been quietly polished rather than aggressively styled, and a look at vuabat 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.

  7. Halfway through I knew I would finish the post, and a stop at gemcoasts also held me through to the end, content that signals its quality early and then sustains it is content with real internal consistency and this site has clearly figured out how to maintain quality from opening sentence through to closing thought.

  8. whoah this weblog is great i really like studying your articles. Stay up the great work! You already know, lots of persons are looking round for this information, you can aid them greatly.

  9. Felt slightly impressed without being able to point to one specific reason, and a look at lunacourt continued that diffuse positive feeling, when content works at a level you cannot easily articulate the writer is doing something with craft rather than just delivering information and that is something I have learned to recognise.

  10. Highly recommend to anyone looking for a sensible take on this topic without the usual marketing nonsense, and a look at homecovidtest kept that grounded approach going, sites that stay focused on serving readers rather than monetising every click are rare and this is clearly one of those rare ones I really appreciate finding.

  11. Considered as a whole this site has developed a coherent point of view that comes through in individual pieces, and a look at oceanhaven 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.

  12. Found this really helpful, the explanations are simple but they actually answer the questions a normal reader would have, and after I followed homecovidtest I had a clearer sense of the topic, no extra fluff just useful points laid out in a sensible order that made the time worth it.

  13. Now feeling confident that this site will continue producing work I will want to read, and a look at palminlet extended that confidence into the future, projecting forward from current quality to expected future quality is something I do for sites I genuinely follow and this one has earned that forward looking trust clearly today.

Deixe um comentário

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