Possible suggestion for removing the GIL

P

Prateek

Hi,

Recently there was some talk on removing the GIL and even the BDFL has
written a blog post on it.
I was trying to come up with a scalable and backwards compatible
approach for how to do it.

I've put my thoughts up in a blog post - and I'd really like to hear
what the community thinks of it.
Mainly it revolves around dedicating one core for executing
synchronized code and doing context switches instead of acquiring/
releasing locks.

http://www.brainwavelive.com/blog/i...oving-the-Python-Global-Interpreter-Lock.html

Thanks,
Prateek Sureka
 
D

Diez B. Roggisch

Prateek said:
Hi,

Recently there was some talk on removing the GIL and even the BDFL has
written a blog post on it.
I was trying to come up with a scalable and backwards compatible
approach for how to do it.

I've put my thoughts up in a blog post - and I'd really like to hear
what the community thinks of it.
Mainly it revolves around dedicating one core for executing
synchronized code and doing context switches instead of acquiring/
releasing locks.

Where is the gain? Having just one core doesn't give you true parallelism -
which is the main reason behind the cries for a GIL-less Python.

Diez
 
P

Prateek

Where is the gain? Having just one core doesn't give you true parallelism -
which is the main reason behind the cries for a GIL-less Python.

Diez

Diez,

I was talking of dedicating one core for synchronized code. In the
case of a threaded app on two cores, one core would be dedicated to
synchronized code and the other would run non-sync code (effectively
behaving like a single threaded machine). However, on machines with n
cores where n > 2 cores, we would have n-1 cores available to run code
in parallel.

Prateek
 
C

Chris Mellon

Diez,

I was talking of dedicating one core for synchronized code. In the
case of a threaded app on two cores, one core would be dedicated to
synchronized code and the other would run non-sync code (effectively
behaving like a single threaded machine). However, on machines with n
cores where n > 2 cores, we would have n-1 cores available to run code
in parallel.

What you're describing would have the same characteristics as the
current code - code that is able to execute without the GIL held
already will run in parallel on a multi-core machine.
 
B

Bryan Olson

Prateek wrote:
[...]
Mainly it revolves around dedicating one core for executing
synchronized code and doing context switches instead of acquiring/
releasing locks.

http://www.brainwavelive.com/blog/i...oving-the-Python-Global-Interpreter-Lock.html

Context switches are generally more expensive than acquiring
and release locks. Most systems' run-queues are protected by
locks. The context switches at issue all involve the
dedicated core, so I do not see any parallelism advantage.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top