[CM] a question for experts?

Fernando Lopez-Lezcano nando at ccrma.Stanford.EDU
Wed May 21 00:56:23 PDT 2008

On Tue, 2008-05-20 at 11:38 -0700, Bill Schottstaedt wrote:
> Max asks "how to use dual-core processors in real time audio
> applications?" -- I would mumble something about threads.
> Actually, I've never looked into how much parallel processing
> they provide.  On my dual-processor machine, I have convinced
> myself that they run at the same time, and in some cases give an
> honest factor of two speed-up (via threads).

Yes, that would make sense. AFAIK in Linux threads are implemented as
processes (well, most probably it is a lot more complicated than
that :-) You can see them with the proper ps incantation (which I don't
remember) or by looking at /proc/PID/task/ (where PID is the pid of the
parent process). 

So, running two cpu intensive threads at the same time in a dual core
machine should result ideally in a 2x improvement in speed, neglecting
any i/o issues, memory caching, etc, etc (which are going to be the big
catch :-) The scheduler in the kernel would hopefully migrate both
threads to different cores - but of course those two threads are not the
only ones executing so it might happen, depending on what you do, that
both land temporarily in the same cpu... 

You can force a thread (through affinity) to stay in a given core but I
would not try to outsmart the linux scheduler (see man taskset). 

-- Fernando

More information about the Cmdist mailing list