[Jack-Devel] Helper threads with lower priority?

Hermann Meyer brummer- at web.de
Sat Jun 29 18:10:33 CEST 2019

Am 29.06.19 um 14:53 schrieb Johannes Lorenz:
> Hello,
> we run a DAW (LMMS) with jack and would like to exploit multiple
> cores. Currently, we have one jack process (using
> `jack_set_process_callback`) and multiple other processes that share
> all the work. The problem is that only the jack process has RT prio.
> Imagine the following example:
> * 4 threads, of which one is the jack thread, 3 have lower priority
> * 4 tasks (e.g. 4 instruments play one note each)
> * the realtime process is finished quickly, the other threads get
> preempted by the kernel
> These are situations where using such non-realtime helper threads can
> threaten realtime behaviour. What is the best practice?
> * Is it possible/good to use multiple rtprio threads controlled by
> jack? (multiple clients, or multiple threads in one client)
> * Should we keep using our non-rt helper threads?
> * Should we be single-threaded, to have a (probably) longer average
> time, but a better worst-case time?
> * Should we start with helper threads and only the last few jobs will
> only be run by the realtime thread (to avoid problems like in the
> example)?
> Many thanks on advance!
> Johannes

We use mutli threads a lot, some helper threads with not so relevant
(mostly GUI) stuff running without rt-priority, but as well some helper
threads running with rt-priority. Therefore we check the priority jack
is running with, and set the priority of our helper threads below that
mark. So, they wouldn't interference with jack ( and didn't be
controlled by jack), but, properly been ready fast enough. Think of
tuners, for example. It didn't needs to be just in time, but, it should
be fast enough that we've a result before the buffer is refiled from
jack. when we lost a buffer, it isn't critical at all.

That may be true for a lot of other stuff as well.



More information about the Jackaudio mailing list