[Stackless] Suggestions: getscheduledcount() and Deadlock Exceptions
Andrew Francis
andrewfr_ice at yahoo.com
Fri Jan 13 15:32:00 CET 2006
Hello Colleagues:
Let me start by thanking everyone for their help in
2005. I wish everyone a happy 2006.
I am slowing getting the hang of Stackless Python, and
perhaps someday I will understand the Tao of Stackless
:-)
In my coding, I notice that deadlock is my biggest
problem. In the near future, I will summarise the help
I have received on the mailing list and post an
article on the Wiki. That said, I notice that one of
my gotchas is being thrown by getruncount(). Some
suggestions.
1. Perhaps it would be feasible to create a new
scheduler property: getScheduledCount(). "scheduled" I
believe is a property of a task - that is the task is
blocked or on the runnable list.
So instead of an idiom like:
while stackless.getruncount() > 1:
stackless.schedule()
one would have
while stackless.getScheduledCount() > 1
stackless.schedule()
Deadlock Detection:
I believe database applications like Berkeley DB have
deadlock detection. I have been reviewing deadlock
detection algorithms seeing if it is possible to use
one with the stackless scheduler. Yes these algorithms
tend to be o(n^2) and perhaps not feasible if there
are too many channels and tasklets. However I would
see a deadlock detector being activated in a debugger
mode, or manually as follows:
# if only the main taskless is running and one knows
there
# are N tasklets
if getruncount() == 1 and getScheduledCount() < n:
try:
stackless.cycleDetect()
except CycleDetectedException:
# print offensive cycle
Perhaps to partition the problem, a TaskletGroup
(similar to a thread group) method could be added. I
find that in my own work, a tasklet spawns other
tasklets and I am interested in them as a group.
Comments?
Cheers,
Andrew
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list