05-05-2024, 07:00 PM
(05-05-2024, 04:01 PM)hifinet Wrote: I came across this post . Any thoughts specifically about the idea of dedicating a CPU core for MPD?
According to the author: By running the MPD process on a dedicated CPU core, it removes the last bit of harshness from the playback and makes the sound even more “analog”.
Thats just the human mind convincing itself of such things.
The fact is that MPD (and most other softwares) are specifically designed as multi-threaded applications that take advantage of multi-core CPU's. You never want to deliberately cram this type of application into a single CPU core :-0
Have a look below at the MPD + CamillaDSP process maps on a 4-core CPU and notice that separate threads of execution are created for specific parts of their main processes. The Linux kernel scheduler manages which physical CPU core a given thread is executed on. What this accomplishes is a high degree of execution parallelism allowing the application to attain max responsiveness, performance and efficiency.
- PID is the process id
- TID is the thread id
- CLS is the kernel scheduling class. TS (time sharing) is the default non-realtime class. FF is realtime FIFO.
- RTPRIO is the realtime priority (1 - 99) where 1 is highest priority.
- PSR is the processor core the thread last ran on
MPD
Code:
pi@moode9:~ $ ps H -q `pidof -s mpd` -o 'pid,tid,cls,rtprio,comm,pcpu psr'
PID TID CLS RTPRIO COMMAND %CPU PSR
43503 43503 TS - mpd 0.9 1
43503 43504 TS - io 0.0 3
43503 43505 FF 40 rtio 0.0 0
43503 43719 TS - player 0.0 1
43503 43720 TS - decoder:faad 0.8 2
43503 43723 FF 40 output:ALSA Def 0.0 1
43503 43782 TS - pcm-io 0.0 0
CamillaDSP
Code:
pi@moode9:~ $ ps H -q `pidof -s camilladsp` -o 'pid,tid,cls,rtprio,comm,pcpu psr'
PID TID CLS RTPRIO COMMAND %CPU PSR
43724 43724 TS - camilladsp 0.6 2
43724 43725 TS - flexi_logger-as 0.0 2
43724 43726 TS - flexi_logger-fl 0.0 1
43724 43727 TS - camilladsp 0.0 0
43724 43728 TS - camilladsp 0.0 2
43724 43729 TS - camilladsp 0.0 2
43724 43731 TS - camilladsp 0.1 1
43724 43732 TS - AlsaPlayback 0.2 0
43724 43733 TS - FileCapture 0.2 3
You can also run these commands inside a watch command and see the kernel scheduler in action as it seamlessly reassigns processor cores (in microseconds) as needed. The -n option is the interval in secs that tells watch how often to run the command.
Code:
watch -n .1 "ps H -q `pidof -s mpd` -o 'pid,tid,cls,rtprio,comm,pcpu psr'"
Also keep in mind that there are a lot of other processes and threads in execution for example the web stack (PHP-FPM and NGINX), moode worker, monitors and watchdog daemons, networking, file management, renderers, etc etc.