Subject: sa/pthread smp concurrency (includes patch)
To: None <>
From: Christian Limpach <>
List: tech-kern
Date: 07/11/2003 02:27:40

I have made the necessary changes to allow a threaded application to use
multiple CPUs if available.  So far this was not possible because an
SA-application could only have one active thread.  Now top shows that my
simple test program which creates several cpu-hungry threads uses close to
200% on my otherwise idle two-cpu machine.  transcode used to encode at
3fps, it's now encoding at almost 5fps (before it crashes :-().

The patch adds concurrency support.  It also adds support for cpu-affinity-
masks (options MPCPUMASK in your kernel config file) which is used to 
address the SMP-specific SA-problems (LWPs fighting over the VP).  Finally 
it includes large parts from Stephan Uphoff's patch to address the 
signal/memory problems.  It's missing locking of the SA data structures 
within the kernel and this will occasionally terminate an application or 
even panic.

The patch includes modifications to libpthread, you'll have to rebuild it. 
The cpu-affinity-masks are i386 only at the moment.

The concurrency support can be enable per-application by setting the
environment variable PTHREAD_CONCURRENCY to the number of available CPUs
(or less).

Patch available at:

Feedback is appreciated.

Christian Limpach <>