[Stackless] Hidden cycles Re: Stackless Digest, Vol 23, Issue 3

Andrew Francis andrewfr_ice at yahoo.com
Wed Dec 14 22:57:41 CET 2005


Hello Richard:

>Because there are no tasklets running, all are
blocked on >channels.  

Yes, you are right, the tasklets are blocked. I should
be more
careful my use of language.

As Asgeir has pinpointed, my joins are sensitive to
order. The fundamental problem is that although the
dependency graph as represented by the hashtable does
not have cycles, in reality there is one. This is the
main thing that has thrown me a loop (no pun
intended). In a haunting way, this is cool. It does
not help that as Activities loop in their "join," the
scheduler is kicking in, changing order. 

>As python exited after stackless.run() executed,
TaskletExit was
>raised on every blocked tasklet, except the last
running tasklet >which had also called .receive().
There might be something to >look into there, whether
that one is getting missed for >TaskletExit being
raised.  

tasks = {}
tasks[stackless.tasklet(f.execute)()] = "F"
 ...
tasks[stackless.tasklet(a.execute)()] = "A"

print "--WAITING--"
try:
   stackless.run()
except:
   print sys.exc_info()[0]
                
print "--FINISHED WAITING--"
                
"""
note I thought queue would be a list?
"""
print
"channelBtoE",channelBtoE.balance,tasks[channelBtoE.queue]
  
print "channelCtoE",
channelCtoE.balance,tasks[channelCtoE.queue]

output     
--FINISHED WAITING--
channelBtoE 1 B
channelCtoE -1 E

Again, I was simply expecting code to hang as a result
of deadlock.

I am interested in coming up with generalised code
that
in a "debugger" mode will "dump" the channels and the
tasks.

Perhaps it would be nice if a BlockedTasklet exception
could be
raised, if there are blocked tasklets after
stackless.run() is
exited. Or is this what TaskletExit suppose to be?

>The Queue put method is non-blocking.
>Your native use of the channel send method is
blocking.

Yes, I realise this. Okay I think I get Asgeir's logic

# omitted self.channel
while queue and contents and balance < 0:
    send(self.contents.pop[0])

if there are no readers, sender simply goes on its
merry way, but not before storing its data in the
content
variable.

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