[LAD] Faster context switch

Michael Ost most at museresearch.com
Tue Nov 2 16:53:48 UTC 2010


Hi list,

I am seeing what appears to be a 4 - 7 usec context switch time on a 3 
GHz Core 2 Duo machine with the 2.6 kernel, and 10 - 15 usecs on a 1.66 
GHz Atom. Is that reasonable? Does anyone have any tips on how to speed 
that up, if possible?

The background is that I have two apps --- one a straight Linux app and 
the other a Wine one. The Linux app is doing the mixing and the Wine app 
is hosting Windows VSTs.

During audio processing I use a sem_t to signal from the mixer app to 
the vst app. Once the vst app is done processing, it signals back to the 
mixer app over another sem_t.

I believe this is roughly the approach taken by other linux audio apps 
to host Wine vsts. And is also something like how Jack does IPC.

But it takes about 4-7 usecs on the faster machine to signal another app 
and have it wake up again. I assume this is the time needed for a 
context switch.

Since this has to happen twice per buffer, at a 32 sample buffer size 
and with 10 VSTs, overhead accounts for about 14% of the CPU. On the 
slower Atom machine, it would account for 33% of the CPU.

Any hints on how to reduce that time, or an alternate IPC design to look 
in to?

Thanks for any help,

Michael Ost
Muse Research, Inc.



More information about the Linux-audio-dev mailing list