Revisiting Linux CPU scheduling
CRANK
blog · git · desktop · images · contact2024-08-03Disclaimer: This is to the best of my knowledge. It's a complicated topic, there are tons of options, and this only covers a tiny fraction of this topic anyway. If you spot mistakes, please tell me.The effects of autogroupA surprisingly long time ago, even though it feels like yesterday, automatic process grouping was added to Linux 2.6.38. It was/is basically a hook into setsid(): That function is usually called in situations like opening a new terminal window. On a call to setsid(), the autogroup feature puts the calling process into a new scheduling group.In other words, each terminal window gets its own scheduling group.Running 4 processes in one terminal and 1 process in another results in 50% of the CPU time for the 4 guys (i.e., one of those gets 1/2 * 1/4 = 1/8, 12.5%) and 50% for the other single process.When you run this, load4.sh, in one terminal:#!/bin/bash children=() for i in $(seq 4) do taskset -c 0 sh -c 'while true;…