Your OS assumes your machine is used for a mix of activities, all of which have the same priority roughly and all must stand in line to get at limited resources. This is mostly terrific and lets us multi-task to our inner ADHD child's content. There are times however when you might want to exercise some control over who goes where and uses what, here's some notes to assist on this task. This is not a proper way to do this(it will all go away on restart for one), I'm not much of a UNIX guru, this is rather an informal cheat sheet to help you get where you are going.
IRQ BalanceStop the OS from sending interrupts fairly:
service irqbalance stop
CPU power saving - cpufreqYour OS is trying to be green and put your CPUs to sleep when it thinks you are not using them. Good for some but not when you are in a hurry:
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governorWhen you are done set it back to scaling the frequency on demand:
echo ondemand | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Pin processes to CPU coresTo put all you processes on a particular cpu mask(0 in this example):
for i in `ps -eo pid` ; do sudo taskset -pc 0 $i ; doneWhen you are done you can let them roam again:
for i in `ps -eo pid` ; do sudo taskset -pc 0-3 $i ; doneThis is useful when benchmarking, everybody moves to one core and you taskset your benchmarking process onto the cores left. Note that some processes may refuse to move. If you are in a NUMA environment you might have to use numactl instead.