Real-time audio on multi-core Linux system -
i'm working on audio application on multi-core (debian) linux machine rt kernel. audio source generation takes lot of processing time can't handled single core, have 3 different threads:
- the main portaudio thread running on core 0
- source generation 1 running on core 1
- source generation 2 running on core 2
thread 2 , 3 writing ringbuffer, while thread 1 reading data ringbuffer , sums portaudio buffer.
i've tried many buffer sizes , scheduling policies, best result fifo policy audio buffer size of 16 stereo samples , ringbuffer size of 576. solution generates more 13ms (576/44100*1000) latency, much.
i'm sure latency can reduced, i'm not expert in linux scheduling. ideas?
as long keep rt prio of process above other on core policy doesn't matter.
make sure kick other application out of cores use rt (e.g. isolcpus=
kernel cmdline parameter). otherwise low-prio processes can trigger i/o block rt threads. should assign interrupts application doesn't care unused core. suggest using core0 normal tasks , cores 1,2,3 rt in case, because since core0 boot cpu have perform special housekeeping tasks.
once partition system described above try latency-measurement tools figure out causing delays. googling linux rt latency trace
give lot of useful links. basic one: http://people.redhat.com/williams/latency-howto/rt-latency-howto.txt
if turns out kernel processing blocking app may find solution looking @ description of kernel threads here: http://lxr.free-electrons.com/source/documentation/kernel-per-cpu-kthreads.txt
you should able go below 2ms.
Comments
Post a Comment