[Stackless] Channel Deadlock

Andrew Francis andrewfr_ice at yahoo.com
Tue Apr 29 21:08:21 CEST 2008

Hi Inhahe:

--- inhahe <inhahe at gmail.com> wrote:
> Hi, I'm interested in these four deadlock
> conditions-- 

These are the four conditions that must occur
simultaneously in order to have deadlock.

>I want to know how I can avoid them 

I guess the short answer is make sure all four
conditions don't occur. I don't have a fool-proof
methodology for this. However the higher hanging fruit
is finding hold-and-wait conditions and cycles. 

>From what I can tell, a hold-and-wait will be a
tasklet blocked on a channel while having the ability
to perform actions on other channels it possesses.

>and how hard stackless is to program in.

Depends on what you are programming. For better or
worse, what I programme and probably my programming
style brings me face-to-face with this stuff

> Can you explain "non-pre-emption" 

In the context of Stackless, a tasklet cannot be
interrupted once it is scheduled.

>and "mutual exclusion"?

A single tasklet has exclusive access to a resource.

> And how does that hold-and-wait example become a
> deadlock?

Ihahe, if you can read the thread "Scheduling
Examples" from December 2005.


Asgeir Ingvarsson correctly diagnosed the problem. The
only thing I can add is that wait-for graphs can come
in handy for determining dependencies.

I have another variation in the paper "Adventures in
Stackless Python Twisted Integration." However I think
the precedence graph example is more common than the
Twisted example which is esoteric.

> Is it easy to avoid all of the deadlock conditions?

I can't say that I have found fool-proof techniques. 


Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

More information about the Stackless mailing list