[C++-sig] [patch] Make boost python accessible by multiple threads

Niall Douglas s_sourceforge at nedprod.com
Sat Jul 17 16:18:29 CEST 2010


On 16 Jul 2010 at 12:33, Jim Bosch wrote:

> But I don't know much more than this, and I'm also curious to hear the 
> story told by someone who has more information...why hasn't 
> multithreading support been added?  Does it just add too much overhead 
> for those who don't need it?

Atomic exchange instructions are a very precious commodity on modern 
systems and become ever more precious over time. Wherever possible 
atomic exchange instructions ought to be avoided for the benefit of 
the whole system.

Besides, one of the big problems with a "naive" threading support 
implementation such as the one just posted is that there are loads of 
occasions (e.g. when checking for an overload of a virtual function) 
when you unlock, do less than 100 cycles of work which doesn't need 
the unlock and relock. That's crazy, and it hammers performance 
across your entire system.

What was discussed on here many months ago was a simple "hanging 
lock" system which avoids the problem above. It will however also 
require source code changes to code using Boost.Python, but wrapper 
generators like Py++ would take most of the pain.

The problem, as always, is funding the time of those to implement a 
proper solution which would pass muster under peer review. The naïve 
implementation is not suitable for mainline, and I agree it should be 
kept out until it's done properly. Annoyingly you could probably get 
a full and proper implementation for just ~US$7-8k as it's a feature 
most Boost developers would feel very favourably toward.

HTH,
Niall

-- 
Technology & Consulting Services - ned Productions Limited.
http://www.nedproductions.biz/. VAT reg: IE 9708311Q. Company no: 
472909.





More information about the Cplusplus-sig mailing list