[Stackless] Scheduling Examples, Problems, Solutions, and Questions

Andrew Francis andrewfr_ice at yahoo.com
Wed Dec 14 20:05:37 CET 2005

Hello Asgeir:

--- Ásgeir Bjarni Ingvarsson <istari at hlekkir.com>

> The reason your channel sample stops is because:
>      1. E is waiting for C -> goto 2
>      2. C is waiting for B -> goto 3
>      3. B is waiting for E -> goto 1
> You become sensitive to the order in which the joins
> are made.

Yes, this is a cycle! Now all the deadlocking
are there.

However what confuses me is the following:

1) B is blocked waiting for E to be ready to read.
2) C is blocked waiting for E to read.

Why doesn't the scheduler detect that E is able to
on channel CtoE and BtoE, hence waking up B and C?
This is
what troubles me.

> Queue.put only blocks if there is someone waiting on
> the channel. Queue.get only blocks if there is no
data waiting.
> B will send "simultaneously" to C and E.
>      Since E has not called get on the BtoE queue
>      and C has not called get on the BtoC queue.
>      This means B is free to push it's data without
> blocking.
> E is waiting for C so it will not resume.
>      E has called get on the CtoE queue and is
> blocked in recieve
> C resumes and when it finishes it sends to D and E.
> E has been waiting for C so now it's recieve on the
> C channel returns
>      There is already data on the BtoE queue so it
> does not have to
>      block.

Thanks alot for the explanation. I find you Queue 
construct very useful. 


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list