Kernel - 3
Yet another journal note. I am following a main trail in the kernel land and have yet to find a good resting spot. This is another note for whence I am finally able to settle for a few days…
Journal Note #2
Digging into Linux Load Average
Generally understood as “the average number of tasks that consume CPU in the last 1/5/15 minutes Per CPU”.
In Linux, this is the exponentially decaying average of nr_running + nr_uninterruptible.
* Once every LOAD_FREQ:
*
* nr_active = 0;
* for_each_possible_cpu(cpu)
* nr_active += cpu_of(cpu)->nr_running + cpu_of(cpu)->nr_uninterruptible;
*
* avenrun[n] = avenrun[0] * exp_n + nr_active * (1 - exp_n)
Forget about “exponentially decaying average” for now. The point is it’s a kind of average of tne number of runnable tasks + number of uninterruptible tasks per cpu.
Why is there uninterruptible tasks here? Actually, what kind of tasks are uninterruptible? Well, turns out read/write to disks are uninterruptible tasks. They are reading/writing to “fast” devices as opposed to “slow” devices which denote things like tty. Question on Adventurer’s Camp
Does that mean uninterruptible tasks also need CPU? - Probably Another question on Adventurer’s Camp. I might want to dig deeper into how an uninterruptible task can be woken up. Does it not trap “SIGNAL” as in those sent from user land or is that referred to something else?