Re: Helper threads with lower priority?
Kjetil Matheussen <[email protected]> Sat, 29 Jun 2019 16:42:31 +0200
| Newsgroups | gmane.comp.audio.jackit |
|---|---|
| Message-ID | <CAC6niEKM10FHFo3GnvK2--Sv58VDMGiifR041zhobRmwdFTqsQ@mail.gmail.com> |
On Sat, Jun 29, 2019 at 2:54 PM Johannes Lorenz <[email protected]> wrote: > > 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) I'm not sure what the problem is... Are you asking if all your threads can call jack_ functions? There are some jack functions (jack_get_time I think) that can be called from a different thread, but this is explicitly documented for each function. If not, it's probably safe to assume that you can't call a jack_ function from a non-jack thread. > * Should we keep using our non-rt helper threads? Probably... > * Should we be single-threaded, to have a (probably) longer average > time, but a better worst-case time? Probably not... > * 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)? > In this scenario, is the realtime thread waiting for a non-realtime thread? Then the answer is no. ;-)