I’m new to multiprocessing – and I may interpreting this wrong – but as I run my programs I notice the more processes I spawn the more ‘sy’ goes up on my linux computer. For example:
Cpu(s): 14.0%us, 24.1%sy, 0.0%ni, 58.8%id, 0.0%wa, 2.2%hi, 0.0%si, 0.8%st
The more processes I spawn the higher the sy process goes and the actual process just gets half’ed(so it was 20%/cpu before it goes to 10%/cpu) and ideal cpu remains the same(almost 60%). I’m not sure if this is a linux question or python question but is there any thing I can do to reduce this number and allow my programs to use more available cpu?
The system CPU time is time used by processes inside the kernel. If you have such a big ratio of system CPU to user CPU, it probably means that your process is doing a lot of system calls.
Don’t think that this is lost time: the kernel is doing something useful for your process.
You might try to e.g. lower the rate of system calls by notably increasing your buffer sizes. Or maybe your processes have too much synchronization primitives.
You might use
straceto find out about system calls done by your processes.