Adding a Par construct to Python?

jeremy at martinfamily.freeserve.co.uk jeremy at martinfamily.freeserve.co.uk
Mon May 18 16:52:12 EDT 2009


On 18 May, 19:58, George Sakkis <george.sak... at gmail.com> wrote:
> On May 18, 5:27 am, jer... at martinfamily.freeserve.co.uk wrote:
>
> > My suggestion is primarily about using multiple threads and sharing
> > memory - something akin to the OpenMP directives that one of you has
> > mentioned. To do this efficiently would involve removing the Global
> > Interpreter Lock, or switching to Jython or Iron Python as you
> > mentioned.
>
> > However I *do* actually want to add syntax to the language.
>
> Good luck with that. The GIL is not going away any time soon (or
> probably ever) and as long as CPython is the "official"
> implementation, there are almost zero chances of adding syntax support
> for this. Besides, Guido and other py-devs are not particularly keen
> on threads as a parallelization mechanism.
>
> George

Hi George,

> The GIL is not going away any time soon (or probably ever) and as long as CPython is
> the "official" implementation, there are almost zero chances of adding syntax support
> for this.

What concerns me about this statement is that, if it is true, Python
risks falling behind when other languages which can exploit multicore
effectively start to come to the fore. I know that Microsoft is
actively researching in this area and they are hoping that F# will
offer good ways to exploit multi-core architectures.

As I understand it the reason for the GIL is to prevent problems with
garbage collection in multi-threaded applications. Without it the
reference count method is prone to race conditions. However it seems
like a fairly crude mechanism to solve this problem. Individual
semaphores could be used for each object reference counter, as in
Java.

Jeremy



More information about the Python-list mailing list