Den 10.08.2011 13:43, skrev Guido van Rossum:
They have a specific plan, based on Software Transactional Memory:
http://morepypy.blogspot.com/2011/06/global-interpreter-lock-or-how-to-kill.html


Microsoft's experiment to use STM in .NET failed though. And Linux got rid of the BKL without STM.

There is a similar but simpler paradim called "bulk synchronous parallel" (BSP) which might work too. Threads work independently for a particular amount of time with private objects (e.g. copy-on-write memory), then enter a barrier, changes to global objects are synchronized and the GC collects garbage, after which worker threads leave the barrier, and the cycle repeats.

To communicate changes to shared objects between synchronization barriers, Python code must use explicit locks and flush statements. But for the C code in the interpreter, BSP should give the same atomicity for Python bytecodes as the GIL (there is just one active thread inside the barrier).

BSP is much simpler to implement than STM because of the barrier synchronization. BSP also cannot deadlock or livelock. And because threads in BSP work with private memory, there will be no trashing (false sharing) from the reference counting GC.

Sturla




_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to