On Sat, Jul 02, 2016 at 09:45:48AM -0400, Paul Davis wrote:
> context switches are not free. their cost varies depending on the size of
> the working set of the process (the amount of memory touched by the
> process, notably during the JACK process() callback).
>
> they might vary from <10 usecs to as much as 500usecs (the lowest possible
> number is dependent on your CPU; the upper bound depends on the clients)
>
> 100 * 100 usecs = 10msecs
>
> so, you've just used 10msecs of the time available for the process
> callback. That's enormous (quite possibly larger than the actual time
> available).
True, assuming you have single linear chain of 100 clients, and
each step involves a context switch.
In practice there are two factors that mitigate this problem:
1. Parts of the graph may run in parallel. And SMP systems
are more or less standard today.
2. Linear chains could be in the same process. In that case,
depending on implementation, you don't even need a thread
switch.