1
2
❯ uptime
 21:40:03 up 4 days, 10:27,  2 users,  load average: 0.40, 0.54, 0.55
  • The current time: 21:40:03

  • How long the system has been running: up 4 days, 10:27 (up 4 days, 10 hours, 27 minutes)

  • The system load averages for the past 1, 5, and 15 minutes

    • the past 1 minute: 0.40

    • the past 5 minutes: 0.54

    • the past 15 minutes: 0.55

System load averages

System load averages is the average number of processes that are either in a runnable or uninterruptable state.

  • A process in runnable (R) state is either using the CPU or waiting to use the CPU.

  • A process in uninterruptable (D) state is waiting for some I/O access, eg waiting for disk.

Load averages are not normalized for the number of CPUs in a system,

  • load average 1 on a single CPU system means it was loaded all the time

  • load average 1 on a 4 CPU system meanns it was idle 75% of the time.

Process States

We can use the command ps to list processes with states.

1
2
3
4
5
6
7
8
❯ ps a
    PID TTY      STAT   TIME COMMAND
  7xxx5 tty7     Ssl+   7:14 /usr/lib/Xorg :0 -seat seat0 -auth /run/lightdm/root/:0 -nolisten tcp vt7 -novtswi
  7xxx6 pts/0    Ss+    0:01 /bin/zsh
  7xxx7 pts/2    Ss+    0:02 /bin/zsh
  8xxx9 pts/3    Ss+    0:00 /bin/zsh
  9xxx1 pts/4    Ss     0:01 /bin/zsh
  9xxx0 pts/4    R+     0:00 ps a

The column with the header STAT, S or STATE in the output of ps command will display characters to describe the state of a process

  • D: uninterruptible sleep (usually IO)

  • I: Idle kernel thread

  • R: running or runnable (on run queue)

  • S: interruptible sleep (waiting for an event to complete)

  • T: stopped by job control signal

  • t: stopped by debugger during the tracing

  • W: paging (not valid since the 2.6.xx kernel)

  • X: dead (should never be seen)

  • Z: defunct ("zombie") process, terminated but not reaped by its parent

Some additional characters may be displayed in this column too

  • <: high-priority (not nice to other users)

  • N: low-priority (nice to other users)

  • L: has pages locked into memory (for real-time and custom IO)

  • s: is a session leader

  • l: is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)

  • +: is in the foreground process group

images/20220204-223211_screenshot.png