[Python-Dev] Making python C-API thread safe (try 2)

Christopher A. Craig list-python at ccraig.org
Fri Sep 12 08:46:54 EDT 2003


Harri Pesonen <fuerte at sci.fi> writes:

> After sleeping over night, I think that I got it. :-) The simple solution is,
> that each thread created in Python gets its own independent interpreter state
> as well. And there could be a separate thread-global interpreter state for
> shared memory access. Access to this global state would always be
> synchronized. There could even be multiple named global states, so that the
> thread interlocking could be minimized. The python syntax for creating objects
> in this global state should be invented:
> 
> 
> synchronize a = "abcd"
> 
> Also when creating the new thread, it's arguments would be copied from the
> creating state to the new state.
> 
> 
> What does it sound? Of course it would be incompatible with the current
> threading system in Python, but it would be totally multithreading, no global
> interpreter lock needed. It would be faster than current Python, there would
> be no need to free or acquire the lock when calling OS functions, and no need
> to check how many byte codes have been processed, etc.
> 

Couldn't you do this now with multiple processes and the shm module?

-- 
Christopher A. Craig <list-python at ccraig.org>
"I affirm brethren by the boasting in you which I have in Christ Jesus
our Lord, I die daily" I Cor 15:31 (NASB)






More information about the Python-list mailing list