adjust thread priorities
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mixxx |
Fix Released
|
Medium
|
RJ Skerry-Ryan |
Bug Description
In general we should avoid messing around with thread priorities because they can lead to deadlocks in realtime kernels. However, I think that certain classes of tasks should take precedence over others.
Here are our current thread priorities:
PA Callback: TimeCriticalPri
ControllerManager: HighPriority
HIDReader: HighPriority
BulkReader: HighPriority
CachingReaderWo
EngineWorkerSch
Main Thread: default
VinylControlPro
LibraryScanner: default
VSyncThread: default
StatsManager: LowPriority
BrowseThread: LowestPriority
AnalyserQueue: IdlePriority
Proposal:
Background tasks (Analyser, Browse, Stats): LowPriority
GUI tasks (Main thread, VSyncThread): NormalPriority
Live input tasks (VinylControl, HID, Bulk, ControllerManager): HighPriority
Audio Processing tasks (PA Calback, CachingReaderWo
Changed in mixxx: | |
milestone: | none → 1.12.0 |
Changed in mixxx: | |
status: | Fix Committed → Fix Released |
We should look exactly to the effect that happens when a certain task is not scheduled in time.
Here my thoughts without additional investigations:
PA Callback -> Audio Droputs eduler > depends on the task (TODO) cessor (does it process the Audiostream? (worst case is absolute position scratch: undesired pitch changes)
ControllerManager / HIReader / BlkReader -> delayed control commands (worst case isabsolute position scratch: undesired pitch changes)
CachingReaderWorker -> Nothing, because we read ahead and there is probably still something in cache.
EngineWorkerSch
Main Thread GUI Thread - > delayed control commands (worst case is Mouse scratch: undesired pitch changes) and waveform stuttering
VinylControlPro
LibraryScanner: Nothing
VSyncThread: waveform stuttering (It produces signals for the GUI thread, so no need for a higher priority then the GUI thread.
StatsManager: Nothing?
BrowseThread: Nothing?
AnalyserQueue: Nothing?
From this point of view we do not need TimeCriticalPri ority for CachingReaderWorker and EngineWorkerSch eduler. ority task this has to do all things that has to be done within one Audio buffer size duration but under no circumstances more. If we have more than one CPU, we can parallelize (divide) this single thread for the available CPUs. But we must not have two concurrent tasks at TimeCriticalPri ority, see https:/ /bugs.launchpad .net/mixxx/ +bug/1203249
IMHO in general we should only have one TimeCriticalPri
It would be also nice to have the GUI task at the same priority than the other input task, but for this it is required to remove all long Slots like db access from it.
Maybe we can also combine all controller polling task to one, to avoid thread changes and random concurrency among them.
CachingReaderWo rker: Reading the needed chunk for the next audio Cycle is somehow TimeCriticalPri ority, but is a blocking call to HD ....
... Many topics to consider.
Currently Mixxx has ~20 threads! In any case to much for such a low latency audio app :-/ -> a lot of room for improvements.