Subversion Repositories HelenOS-doc

Compare Revisions

Ignore whitespace Rev 74 → Rev 75

/design/trunk/src/ch_scheduling.xml
124,16 → 124,24
<formalpara>
<title>Thread states</title>
 
<para>In each moment, a thread exists in one of five possible thread
<para>In each moment, a thread exists in one of six possible thread
states. When the thread is created and first readied into the
scheduler's run queues or when a thread is migrated to a new processor,
it is put into the <code>Entering</code> state. After some time, the
scheduler picks up the thread and starts executing it. A thread being
currently executed on a processor is in the <code>Running</code> state.
From there, the thread has three possibilities. It either runs until it
is preemtped, in which case the state changes to <code>Ready</code>,
goes to the <code>Sleeping</code> state by going to sleep or enters the
<code>Exiting</code> state when it reaches termination.<figure>
it is put into the <constant>Entering</constant> state. After some time,
the scheduler picks up the thread and starts executing it. A thread
being currently executed on a processor is in the
<constant>Running</constant> state. From there, the thread has three
possibilities. It either runs until it is preemtped, in which case the
state changes to <constant>Ready</constant>, goes to the
<constant>Sleeping</constant> state by going to sleep or enters the
<constant>Exiting</constant> state when it reaches termination. When the
thread exits, its kernel structure usually stays in memory, until the
thread is detached by another thread using <code>thread_detach</code>
function. Terminated but undetached threads are in the
<constant>Undead</constant> state. When the thread is detached or
detaches itself during its life, it is destroyed in the
<constant>Exiting</constant> state and the <constant>Undead</constant>
state is not reached.<figure>
<title>Transitions among thread states.</title>
 
<mediaobject id="thread_states" xreflabel="">