Kernel states, the complete list

Here's the complete list of kernel blocking states, with brief explanations of each state.

By the way, this list is available in <sys/states.h>—you'll notice that the states are all prefixed with STATE_ , but the prefix tends to be omitted in conversation and the documentation (for example, “READY” is really STATE_READY):

If the state is: The thread is:
STATE_CONDVAR Waiting for a condition variable to be signaled
STATE_DEAD Dead. Kernel is waiting to release the thread's resources
STATE_INTR Waiting for an interrupt
STATE_JOIN Waiting for the completion of another thread
STATE_MUTEX Waiting to acquire a mutex
STATE_NANOSLEEP Sleeping for a period of time
STATE_NET_REPLY Waiting for a reply to be delivered across the network
STATE_NET_SEND Waiting for a pulse or message to be delivered across the network
STATE_READY Not running on a CPU, but is ready to run (one or more higher or equal priority threads are running)
STATE_RECEIVE Waiting for a client to send a message
STATE_REPLY Waiting for a server to reply to a message
STATE_RUNNING Actively running on a CPU
STATE_SEM Waiting to acquire a semaphore
STATE_SEND Waiting for a server to receive a message
STATE_SIGSUSPEND Waiting for a signal
STATE_SIGWAITINFO Waiting for a signal
STATE_STACK Waiting for more stack to be allocated
STATE_STOPPED Suspended (SIGSTOP signal)
STATE_WAITCTX Waiting for a register context (usually floating point) to become available (only on SMP systems)
STATE_WAITPAGE Waiting for process manager to resolve a fault on a page
STATE_WAITTHREAD Waiting for a thread to be created

The important thing to keep in mind is that when a thread is blocked, regardless of which state it's blocked in, it consumes no CPU. Conversely, the only state in which a thread consumes CPU is in the RUNNING state.

We'll see the SEND, RECEIVE, and REPLY blocked states in the Message Passing chapter. The NANOSLEEP state is used with functions like sleep(), which we'll look at in the chapter on Clocks, Timers, and Getting a Kick Every So Often. The INTR state is used with InterruptWait(), which we'll take a look at in the Interrupts chapter. Most of the other states are discussed in this chapter.