Follow

today i'm learning about and the mysterious "load average", that number about how many processes have run last 1,5,15 mins.

i read this wonderful head comment on `kernel/sched/loadavg.c`:

"This file contains the magic bits required to compute the global loadavg figure. Its a silly number but people think its important."
raw.githubusercontent.com/torv

just what i suspected 😂😂

@jartigag at the risk of telling you something you weren't at all interested in: it is not the number of processes that were actually run, but the number of processes that were in an executable state, I. E. not waiting for I/O or something else. I tend to think of it as the number of cores that could have been utilised.

@jartigag that is also were the "importance" comes from. On a batch system where CPU cycles are expensive and you only care about throughput, not latency, you want load to always exceed the number of cores. This, you tend to aim for load to be twice or even four times your core count. On an interactive system like your laptop however you care mostly about latency. So whenever load starts exceeding the number of cores that's an issue as applications will start feeling laggy.

@marix not sure if i understood it..

on a batch system, you want load (the number of cores that could have been utilised) to be twice your core count?

wouldn't it mean the processes in an executable state need more cores than you have?

@jartigag it is a role of thumb. It means that whenever a process gets stuck, like waiting for the network, there will be another process that will happily utilise the available CPU cycles. But yes, you could in that case utilise twice the core count. But then you'd no longer be able to utilise all CPU cycles as processes get stock waiting for stuff all the time.

@marix @jartigag leads on to the interesting subject of governors, something that appears to be "commonly" tweaked on Android devices (ok some of us do) but you se little mention of changing the CPU governor on a standard x86 PC but I'm pretty sure you can and it's trivial. Maybe it's automatic? Probably should be on any desktop machine to perform best depending on current usage profile...

@marix you're absolutely right, i didn't express it correctly.
i wrote it down as "the exp. mov. avg. across the load number" on my notes

@jartigag load average may not be accurate but every time I see it going crazy high I almost immediately find someone doing something silly on the system.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!