I'm trying to map Linux process state codes (as in ps) to states in the OS state diagram but I can't seem to map them. Is it because Linux process states don't necessarily match the theoretical OS state diagram? Specifically, I am unsure where D/S/T/I fit in the diagram.

  • ps process state codes from the man page:

           Here are the different values that the s, stat and state output
           specifiers (header "STAT" or "S") will display 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
                   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
  • OS process state diagram from Wikipedia:

    OS process state diagram

Similar to Does "stopped" belong to "blocked" state? but the answer is pretty incomplete.

1 Answer 1


Short answer:

The states (roughly) map like this:

State Meaning
D Blocked
I Blocked
R Waiting or Running
S Blocked
T Blocked (more or less)
t Blocked (more or less)
W Blocked (obsolete since Linux 1.1.30)
X Terminated
Z Terminated

Long answer:

The externally visible process state codes in Linux try to pack information that might be interesting for a system administrator into one character, so they also include information why a process is blocked (and thus if it can be unblocked and what may unblock it).

The distinction between "Waiting" and "Running" is blurred, because processes run in such tiny time slices that, for a human sitting in front of the computer, there is not much difference between a process ready to run and a process running.

Also Linux doesn't swap out whole processes but individual memory pages, so you won't find states mapping to "Swapped out and waiting" or "Swapped out and blocked".

State Meaning
D The process is blocked and that state cannot be interrupted (e.g. with kill). Usually while in this state the kernel is performing I/O on behalf of the process, and the kernel code in question isn't able to handle interruptions.
I The process is a kernel thread that currently has nothing to do and is blocked waiting for new work. This state is technically the same as D (as usually kernel threads aren't interruptible). It was introduced for accounting/cosmetic reasons, because processes in D state are considered contributing to the system load.
R The process is waiting to run or running. These are all processes the scheduler can and will schedule on the available CPUs. Internally the kernel can differentiate between running and waiting processes but this isn't exposed through the process state codes.
S The process is blocked and that state can be interrupted with kill. This state is entered with most system calls that wait for some event (sleep, select, poll, wait, etc.).
T The process is blocked from being scheduled by a signal like SIGSTOP. This state doesn't match perfectly into the theoretical state "Blocked" because the process doesn't wait for an event by itself, but is usually blocked from further running by intervention of another process or the user (Ctrl+Z).
t Similar to above. The process is blocked from being scheduled by a debugger or tracing process, not by itself waiting for an event.
W Obsolete. The process is blocked waiting for a memory page to be read from swap into RAM. This code was used up until Linux v1.1.30. Since v2.3.43 there's no way to put a process in this state any more, and since v2.5.50 every reference to this state was removed.
X The process is terminated and currently being removed from the process list. You won't see this state often as it only appears when ps runs exactly in the split second while the kernel cleans up a process entry on another CPU core.
Z The process is terminated and the entry in the process list only exists so that the parent process can collect the exit status information.
  • 2
    Linux is far from the only OS that does page-based swapping instead of whole-process wapping. In fact, I don’t think any modern consumer OS swaps whole processes in and out, dynamic linking makes it a rather complex affair to do so and it has little to no benefit over page-based swapping. Apr 28, 2021 at 14:34
  • 5
    @AustinHemmelgarn of course Linux isn't the only OS using page-based swapping, but the question was about process states in Linux, so I only wrote about the situation on Linux
    – cg909
    Apr 28, 2021 at 15:14
  • 1
    My only point was that it might be worth calling those states out as something unlikely to be found in any modern OS, not just something Linux lacks due to it’s own implementation. Apr 28, 2021 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .