[Stackless] More questions on stackless.run()
andrewfr_ice at yahoo.com
Sat Jun 15 02:02:12 CEST 2013
From: Bin Huang <bin.arthur at gmail.com>
To: Andrew Francis <andrewfr_ice at yahoo.com>
Cc: "stackless at stackless.com" <stackless at stackless.com>
Sent: Friday, June 14, 2013 4:29 PM
Subject: More questions on stackless.run()
>As you suggested, I found thinking of stackless.run() being in an infinite loop was helpful. So I >went on to test stackless.run() in a few different scenarios. This time, I got confused by different >outputs in different scenarios.
Typically you execute stackless.run() once. A common structure for a Stackless Python
I ought to look at how stackless.run() is implemented but think of stackless.run conceptually
as a pump that schedules tasklets as long as there are runnable tasklets. Again, conceptually
stackless.run() is akin to:
while stackless.getruncount() > 1:
As long as there is more than one tasklet (the main), the next tasklet in the runnable queue will be
>Third, if I don't even call stackless.run(), the stackless runtime is still able to schedule some tasklets >to run (e.g., code #2). Why is this?
Good question. I don't have a good answer (without looking at the code) but a number of operations
will engage the scheduler and get the ball rolling. The scheduler in non-preemptive mode is a passive entity: it has to be called to do things.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Stackless