Closed nberrios closed 6 years ago
The kqueue structure is used in determining which task will run next in the kernel scheduler. Right now it's a deque(), but it could be changed to something else should priority queuing be added.
_wake_queue and _sleeping are internal data structures used for a different purpose than task scheduling decisions. _wake_queue contains tasks awakened by the completion of Futures in separate execution threads. _sleeping is used to manage time (and in the current version of Curio is replaced by a special TimeQueue class).
Ah, I see! Thanks for the speedy response, Dave. Closing this question
Although the kqueue name can be a little confusing if you're familiar with BSD kernels. ;-)
I'd agree on the kqueue name. Honestly, the whole 'kqueue' thing was used more in earlier versions of Curio, but was abandoned to focus on more varied kinds of scheduling primitives. Maybe I'll just delete this.
In curio/kernel.py there is the disclaimer:
I noticed however that the wake and sleeping queues are not following the same design. See:
If this is intentional, could someone briefly explain why the wake/sleep queues need to be handled differently than the ready queue? Thanks