Charming Python: Implementing "weightless threads" with Python generators
Submitted By:
WEBMASTER
Rating:
(Not rated) (
Rate It)
Share:
By Email
Visit
Description
In a related "Charming Python" installment, David introduces a way of simulating full-fledged coroutines with generators and a simple scheduler. It is possible to extend this scheduler in straightforward ways to allow extremely lightweight threading of multiple processes. Much as with Stackless Python microthreads, pseudo-coroutine "weightless threads" require almost none of the context switch and memory overhead of OS -- or even userland -- threads. Here David introduces weightless threads as an elegant solution for problems whose natural solutions involve large numbers of cooperating processes.
Comments (0)
Add Your Rating