On Nov 18, 2008, at 11:32 AM, Timothy Baldridge wrote:
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.
Hm. Are you forgetting that "objects" in Python are all by reference.
And therefore it is pretty much impossible to "contain" them.
Imagine I create a message:
msg = [ [1,2], [3,4] ] # Notice msg is a reference to a tree of 7
objects
Then I pass this message to 2 different tasks running in parallel
and they both do something like:
del msg[0][1]
What happens in the absence of a lock (the GIL) on msg[0]?
One solution, of course, is to deep copy all messages whenever they
cross a "boundary"... which will very quickly become a rat hole...
and you might as well simply run a separate python interpreter
per-thread and pickle/unpickle all the messages moving between
them... probably not what you had in mind...
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless