Load Average

  • by

Linux commands like top, uptime and w report the system load average. For instance, the first line of top command output is something like,

top - 04:56:31 up 60 days, 23:18, 1 user, load average: 0.02, 0.06, 0.05

The last three numbers give the load average for the last one minute, five minutes and fifteen minutes respectively. Load average is an indication of whether the system resources (mainly the CPU) are adequately available for the processes (system load) that are running, runnable or in uninterruptible sleep states during the previous n minutes. A process is a running when it has the CPU. A runnable process is a process that is waiting for the CPU. A process is in uninterruptible sleep state when it is waiting for a resource and cannot be interrupted and will return from sleep only when the resource becomes available or the timeout occurs (if it had gone to sleep with a timeout). For example, a process may be waiting for disk or network I/O. Runnable processes indicate that we are short of CPUs, for each additional CPU, a runnable process would have been given that CPU, changing the state of that runnable process to running. Similarly processes in uninterruptible sleep state indicate I/O bottlenecks. The load number at any time is the number of running, runnable and uninterruptible sleep state processes (we will call these collectively runnable processes) in the system. The load average is the exponential moving average of the load number during the previous n minutes.

If in a single CPU system, the load average is 5, it is an undesirable situation because one process runs on the CPU and the other 4 have to wait for their turn. So the system is overloaded by 400%. If we had two CPUs and a load average of 5, we are a little better off but not quite. Out of 5, 2 processes get the CPU and the other 3 have to wait for their turn and the system is overloaded by 300%. If the number of CPUs equals the number of runnable processes, we are breakeven. In the above top command first line output, assuming a single-CPU system, the load average for the last minute is 0.02, which indicates that the CPU is underloaded 98%. Load average figures help in figuring out how much our system is able to cater to the processing demands and also provide useful input in load balancing of systems.

/proc/loadavg

Load average is available in the file /proc/loadavg, from where it is picked up by the commands like top. One can print this file,

$ cat /proc/loadavg
0.14 0.05 0.06 1/122 13870

The format of /proc/loadavg is that the first three words give load average for 1 minute, 5 minutes and 15 minutes respectively. The next word has two numbers separated by a slash. The number before the slash gives the number of threads running at that moment. This will obviously be less than or equal to the CPUs in the system. The number after the slash indicates the total number of threads in the system. The last word in /proc/loadavg is the process Id of the thread that ran last.

CPU utilization versus load average

Load average gives a better picture of the system's capability to meet processing requirements. CPU utilization is the time the CPU is working expressed as a percentage of the total elapsed clock time. On process intensive systems this could be 100%. Assuming a single CPU system, the load average may be any number greater than 1. In all cases, where the load average is greater than 1, CPU utilization could be around 100%. But the problem becomes more and more severe as the load average takes on higher number values (1, 2, 3, ...). But all cases, the CPU utilization may be around 100%.

See also

Subscribe
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

You may like these, also

  • POSIX message queues in LinuxPOSIX message queues in Linux 1.0 POSIX Message queues POSIX interprocess comunication (IPC) was introduced in the POSIX.1b standard (IEEE Std 1003.1b-1993) for real time…
  • POSIX Shared Memory in LinuxPOSIX Shared Memory in Linux 1.0 Shared Memory Shared memory is the fastest method of interprocess communication (IPC) under Linux and other Unix-like systems. The…
  • POSIX Semaphores in LinuxPOSIX Semaphores in Linux 1.0 Semaphores Semaphores are used for process and thread synchronization. Semaphores are clubbed with message queues and shared memory under…
  • fork and exec system calls in Linuxfork and exec system calls in Linux 1.0 fork and exec system calls Suppose we wish to write a "shell program" which would execute another program. Now,…
  • Connecting two computers with Ethernet LAN cableConnecting two computers with Ethernet LAN cable Quite often, we wish to connect two computers back to back using an Ethernet LAN cable. It may be because…
  • D-Bus TutorialD-Bus Tutorial 1.0 D-Bus D-Bus is a mechanism for interprocess communication under Linux and other Unix-like systems. D-Bus has a layered architecture.…
  • Socket programming using the select system callSocket programming using the select system call 1.0 Client-Server Paradigm The Client-Server paradigm divides the software architecture of a system in two parts, the server and its…
  • System V message queues in LinuxSystem V message queues in Linux 1.0 Message queues Message queues are one of the interprocess communication mechanisms available under Linux. Message queues, shared memory and…
  • POSIX Threads Synchronization in CPOSIX Threads Synchronization in C 1.0 POSIX Threads Synchronization POSIX Threads provide multiple flows of execution within a process. The threads have their own stacks…
  • System V Shared Memory in LinuxSystem V Shared Memory in Linux 1.0 Shared Memory Shared memory is one of the three interprocess communication (IPC) mechanisms available under Linux and other Unix-like…