[Python-ideas] The async API of the future: yield-from
greg.ewing at canterbury.ac.nz
Sat Oct 20 07:19:11 CEST 2012
Jim Jewett wrote:
> Who says that there has to be a scheduler? Or at least a single scheduler?
> To me, the "obvious" solution is that each co-routine is "scheduled"
> only by its own caller, and runs on its own micro-thread.
I think you may be confused about what we mean by a "scheduler".
The scheduler is not something that you tell which task should
run next. Rather, the scheduler decides which task to run
next when the current task says "I'm waiting for something,
let someone else have a turn." The task that gets run will
very often be one that the suspending task knows nothing
It's for that reason -- not all the tasks know about each
other -- that I think it's best to have only one scheduler in
any given system, so that it can make the best decision about
what to run next.
More information about the Python-ideas