Exploiting Dual Core's with Py_NewInterpreter's separated GIL ?

robert no-spam at no-spam-no-spam.invalid
Fri Nov 3 12:13:51 EST 2006


Daniel Dittmar wrote:
> robert wrote:
>> ---- Question Besides:  do concurrent INC/DEC machine OP-commands 
>> execute atomically on Multi-Cores as they do in Single-Core threads?
> 
> No on the level that that Python reference counting is implemented. The 
> CPUs have often special assembler ops for these operations. I think that 
> it's even more complicated as some machines require additional read and 
> write barriers around these operations.
> 
>>> Take a look at IPython1 and it's parallel computing capabilities [1,
> [...]
>> I do selected things with interprocess shared memory techniques 
>> already. Thats medium efficent.
>> Multiple interpreters inside one process seem to be most promising for 
>> seemless multi-core programming. 
> 
> Both IPython and Jython use multiple CPUs without the GIL, so you don't 
> need to add the complication of multiple interpreters.

(IPython is only a special "python network terminal" as already said.)

With Jython I'm not familiar. Yet I think going to Jython will first cost more performance than you can win - at least on only dual cores as we have now. In 5 years with > 8x MPU systems this may be different ... 
Does Jython really eliminate the GIL? What happens when different threads alter/read a dict concurrently - the basic operation in python, which is usually not protected by locks. Does Jython use a dict data type (and other collection types) which lock during _each_ access? in case - that may be very expensive.

>  > As all Python objects share the same
>  > malloc space - thats the key requirement in order to get the main
>  > effect. As soon as with have object pickling in between its well away
>  > from this very discussion.
> 
> There's the complication that CPython has garbage collection in addition 
> to reference counting. I'm not sure what happens when the garbage 
> collector looks at objects rooted in another interpreter.

garbage is collected earliest, when the refcount went to 0. If it ever went to 0, no one will ever use such object again. Thus GC should not be different at all.


robert



More information about the Python-list mailing list