Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > [ANN]: "newthreading" - an approach to simplified thread usage, anda path to getting rid of the GIL

Reply
Thread Tools

[ANN]: "newthreading" - an approach to simplified thread usage, anda path to getting rid of the GIL

 
 
John Nagle
Guest
Posts: n/a
 
      06-25-2010
We have just released a proof-of-concept implementation of a new
approach to thread management - "newthreading". It is available
for download at

https://sourceforge.net/projects/newthreading/

The user's guide is at

http://www.animats.com/papers/langua...dingintro.html

This is a pure Python implementation of synchronized objects, along
with a set of restrictions which make programs race-condition free,
even without a Global Interpreter Lock. The basic idea is that
classes derived from SynchronizedObject are automatically locked
at entry and unlocked at exit. They're also unlocked when a thread
blocks within the class. So at no time can two threads be active
in such a class at one time.

In addition, only "frozen" objects can be passed in and out of
synchronized objects. (This is somewhat like the multiprocessing
module, where you can only pass objects that can be "pickled".
But it's not as restrictive; multiple threads can access the
same synchronized object, one at a time.

This pure Python implementation is usable, but does not improve
performance. It's a proof of concept implementation so that
programmers can try out synchronized classes and see what it's
like to work within those restrictions.

The semantics of Python don't change for single-thread programs.
But when the program forks off the first new thread, the rules
change, and some of the dynamic features of Python are disabled.

Some of the ideas are borrowed from Java, and some are from
"safethreading". The point is to come up with a set of liveable
restrictions which would allow getting rid of the GIL. This
is becoming essential as Unladen Swallow starts to work and the
number of processors per machine keeps climbing.

This may in time become a Python Enhancement Proposal. We'd like
to get some experience with it first. Try it out and report back.
The SourceForge forum for the project is the best place to report problems.

John Nagle
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN]: "newthreading" - an approach to simplified thread usage, anda path to getting rid of the GIL John Nagle Python 2 06-25-2010 11:41 PM
xmlrpc idea for getting around the GIL Patrick Stinson Python 4 11-24-2009 06:17 PM
Akan kaya melebihi mimpi anda rosma Java 0 08-18-2008 01:36 PM
Endless GIL and thread confusion enska Python 3 11-01-2007 02:04 AM
Getting around the GIL with POSH Michael Hudson Python 2 08-06-2004 03:32 PM



Advertisments