26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG. The kernel’s role<br />

If the state is:<br />

CONDVAR<br />

DEAD<br />

INTR<br />

JOIN<br />

MUTEX<br />

NANOSLEEP<br />

NET_REPLY<br />

NET_SEND<br />

READY<br />

RECEIVE<br />

REPLY<br />

RUNNING<br />

SEM<br />

SEND<br />

SIGSUSPEND<br />

SIGWAITINFO<br />

STACK<br />

STOPPED<br />

WAITCTX<br />

WAITPAGE<br />

WAITTHREAD<br />

The thread is:<br />

Waiting for a condition variable to be signaled.<br />

Dead. Kernel is waiting to release the thread’s resources.<br />

Waiting for an interrupt.<br />

Waiting for the completion of another thread.<br />

Waiting to acquire a mutex.<br />

Sleeping for a period of time.<br />

Waiting for a reply to be delivered across the network.<br />

Waiting for a pulse or message to be delivered across the network.<br />

Not running on a CPU, but is ready to run (one or more higher or<br />

equal priority threads are running).<br />

Waiting for a client to send a message.<br />

Waiting for a server to reply to a message.<br />

Actively running on a CPU.<br />

Waiting to acquire a semaphore.<br />

Waiting for a server to receive a message.<br />

Waiting for a signal.<br />

Waiting for a signal.<br />

Waiting for more stack to be allocated.<br />

Suspended (SIGSTOP signal).<br />

Waiting for a register context (usually floating point) to become<br />

available (only on SMP systems).<br />

Waiting for process manager to resolve a fault on a page.<br />

Waiting for a thread to be created.<br />

The important thing to keep in mind is that when a thread is blocked, regardless of<br />

which state it’s blocked in, it consumes no CPU. Conversely, the only state in which a<br />

thread consumes CPU is in the RUNNING state.<br />

We’ll see the SEND, RECEIVE, and REPLY blocked states in the Message Passing<br />

chapter. The NANOSLEEP state is used <strong>with</strong> functions like sleep(), which we’ll look at<br />

in the chapter on Clocks, Timers, and <strong>Getting</strong> a Kick Every So Often. The INTR state<br />

is used <strong>with</strong> InterruptWait(), which we’ll take a look at in the Interrupts chapter. Most<br />

of the other states are discussed in this chapter.<br />

April 30, 2009 Chapter 1 • Processes and Threads 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!