Scheduling

At any given time, a thread is in one of three states: running, blocked, or ready. A thread is running when it`s using a CPU to execute its program. A thread is blocked when it can't run for some reason, such as when it needs resources that are temporarily unavailable. When a thread blocks, its local data (stack) and its current position in its program (program counter) are saved so the thread can resume execution later. A blocked thread becomes ready when the condition that has been blocking it changes, allowing the thread to unblock; the thread is then able to continue running its program where it left off. The scheduler can also preempt (interrupt) a running thread to allow another thread to run; in this case the preempted thread enters the ready state without ever blocking.

The operating system's scheduler decides when to run each ready thread according to its schedule, the algorithm that determines when a thread runs, how long it runs, and what threads can preempt it. A thread's schedule depends on its purpose. The scheduling requirements of an application thread, for example, are different from those of a thread that handles user input. The CommonPoint application system defines several schedule types:



[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker