Kernel states, the complete list

QNX SDP8.0Getting Started with the QNX OSDeveloperUser

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_BARRIER Blocked on a barrier (e.g., after calling pthread_barrier_wait())
STATE_CONDVAR Waiting for a condition variable to be signaled
STATE_DEAD Dead; the kernel is waiting to release the thread's resources
STATE_INTR Waiting for an interrupt
STATE_INTR_ATTACH_EV In a call to InterruptAttachEvent(), waiting for the associated interrupt service thread (IST) to be created
STATE_JOIN Waiting for the completion of another thread
STATE_MQ_RECEIVE Waiting on an empty queue after calling mq_receive()
STATE_MQ_SEND Waiting on a full queue after calling mq_send()
STATE_MUON_MUTEX Blocked on an internal kernel mutex
STATE_MUTEX Waiting to acquire a mutex
STATE_NANOSLEEP Sleeping for a period of time
STATE_PIPE Waiting to proceed with an I/O operation on an in-kernel pipe
STATE_READY Not running on a CPU, but 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_RWLOCK_READ Blocked trying to acquire a non-exclusive lock of a reader/writer lock after calling pthread_rwlock_rdlock()
STATE_RWLOCK_WRITE Blocked trying to acquire an exclusive lock of a reader/writer lock after calling pthread_rwlock_rdlock()
STATE_SEM Waiting to acquire a semaphore
STATE_SEND Waiting for a server to receive a message
STATE_SEND_NOTIFY Waiting for a notification of a send-blocked client thread on a channel
STATE_SIGSUSPEND Waiting for a signal
STATE_SIGWAITINFO Waiting for a signal
STATE_STOPPED Stopped, for example by a SIGSTOP or ThreadCtl()
STATE_TIMER_DELEGATE In a call to TimerDelegate() with the _NTO_TIMER_DELEGATE command, waiting for the clock IST to finish
STATE_TRACEBUFFER In a call to TraceEvent() with the _NTO_TRACE_WAITBUFFER command, waiting for the kernel to flush a tracebuffer for the current CPU
STATE_WAITPAGE Waiting for the process manager to resolve a fault on a page

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 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(). 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.

Page updated: