Is it possible to use multiple cores in an audio thread?

I am developing an audio app for iOS (although the question is probably equal for OSX) and I was wondering how to utilize multiple cores of the device. I can of course run multiple threads, but since I assume the audio thread runs in a real-time thread and any thread that the app creates would not run as a real-time thread and at lower priority, I can imagine this would lead to problems like priority inversion. At some point in time, the audio thread would need to wait (bad!) for the result of a thread to come back. Any thoughts on this subject?

Replies

Curious if you uncovered more on this? I’m tracking a bug with real time CoreAudio streams losing thread priority to the MBP AppleSmartBatteryManager driver polling the battery state. Trying to find a solution to either insure CoreAudio real-time processing priority on its own thread, separate of the kernel battery processes and other background system items.

The real-time audio context thread should probably never wait (lock), especially when configured for short callback buffers, but instead perform some sort of underflow error conceilment if the (non-real-time) audio worker threads haven't already supplied enough of the needed data (samples or options etc.) in time. With enough processor bandwidth/cores, multiple worker threads can offer speculative options for a real-time audio callback to quickly select from.