Idea for removing the GIL...

Vishal vsapre80 at gmail.com
Tue Feb 8 07:34:46 EST 2011


On Feb 8, 3:05 pm, Adam Tauno Williams <awill... at whitemice.org> wrote:
> On Tue, 2011-02-08 at 01:39 -0800, Vishal wrote:
> > Is it possible that the Python process, creates copies of the
> > interpreter for each thread that is launched, and some how the thread
> > is bound to its own interpreter ?
> > and it "may" also allow the two threads to run in parallel, assuming
> > the processors of today can send independent instructions from the
> > same process to multiple cores?
> > Comments, suggestions, brush offs  are welcome :))
>
> Yes, it is possible, and done.  See the multiprocessing module.  It
> works very well.
> <http://docs.python.org/library/multiprocessing.html>
>
> It isn't exactly the same as threads, but provides many similar
> constructs.

Hi,

Pardon me for my ignorance here, but 'multiprocessing' creates actual
processes using fork() or CreateProcess().
I was talking of a single process, running multiple instances of the
interpreter. Each thread, bound with its own interpreter.
so the GIL wont be an issue anymore...each interpreter has only one
thing to do, and that one thing holds the lock on its own interpreter.
Since its still the same process, data sharing should happen just like
in Threads.

Also, multiprocessing has issues on Windows (most probably because of
the way CreateProcess() functions...)

Thanks and best regards,
Vishal



More information about the Python-list mailing list