[mkc2007] thread halt/resume

Marcus Voelp voelp at os.inf.tu-dresden.de
Thu May 10 08:47:33 CEST 2007


Benjamin Engel wrote:
> Hi,
>
> I would like to know how to make a thread *not ready*. I tried to add a
> function like halt_myself(), looked up the thread, invoked that function
> and did a state_del( Thread_ready ) and ready_dequeue() from within.
> after that i did a schedule() if the thread wants to halt itself.
>   
You are not interruptible in between deleting Thread_ready and 
ready_dequeue, right?

If so please provide me your code so that I can have a look at it. A 
similar implementation worked with me - though it was not tested for all 
corner cases.
> Scheduling continued and the next time the halted thread was
> considered as next_to_run it's state was still ready - why?
>
> Additionally i would like to know what will/should happen if a thread is
> halted and gets an ipc. I would prefer that it stays halted and blocks
> the other thread as well - if this is possible/reasonable. Similarly a
> thread *doing* ipc that is being halted should stay out of the ready
> queue until it is resumed, therefore staying within its ipc handling for
> a very long time. how to do that or is this unreasonable?
>   
The last exercise asks you to resume this thread, i.e., to set it 
runnable again. The IPC is only delivered after the thread performs a 
respective receive operation.

Blocking the sender could be useful in a real system, but I'm not sure 
how difficult it is to implement. Feel free to try. This should in 
principle work out of the box as the sender should automatically block 
in the halted thread's send queue because the latter is not receiving.

Best regards

    Marcus

-- 
Marcus Völp

Technische Universität Dresden
Department of Computer Science
Institute for System Architecture 

Tel: +49 (351) 463 38350
Fax: +49 (351) 463 38284

Email: voelp at os.inf.tu-dresden.de
Web: http://os.inf.tu-dresden.de/~voelp




More information about the mkc2007 mailing list