[Stackless] Multi-CPU Actor Based Python
tbaldridge at gmail.com
Tue Nov 18 17:32:04 CET 2008
I've been working on getting a actor based framework setup and working
in Stackless Python. A true object-oriented, actor based framework I
would allow us to get rid of the GIL in python (for the most part) but
still keep the routines just as fast as they are now. For information
on Actor based models, try this link:
In my code I have the following setup. First of all we create a list
for use as a queue in every object. Then we override the
__getattribute__ to make it append function calls to this list.
Thirdly we have a tasklet that gets items from this queue and exectues
the requested functions, returning data to a specified queue if
Because all information for an object is contained in that object
(including message queues, and data). We could remove all locks from
the list objects, as the internal object tasklet will be the only
object modifying the code. These queues are the only parts that would
need to be locked, and those can be created via CAS operations, we
could take out 90% of the locks in Python.
At this point, it should be possible for each CPU on a system to do a
round-robin on the tasklets, executing a few instruction then moving
on . I have this framework hacked out in stackless python, but the
issue is that the entire framework will still run on one VM/CPU
because of the limitations of stackless and python in general.
I'm interested in creating a branch of stackless and working on
developing these concepts. If someone is willing to give some pointers
/comments/ help I'd love to hear it.
I know this will break allot of things, but should also allow
programmers to build much more responsive and scalable apps.
Two wrights don't make a rong, they make an airplane. Or bicycles.
More information about the Stackless