Figure 3-4 shows tasks (or worker processes) queued up for an Adaptive Server engine in a single-CPU environment. This figure switches from Adaptive Server in the operating - system context (as shown in Figure 3-2) to Adaptive Server internal task processing. Adaptive Server, not the operating - system, dynamically schedules client tasks from the run queue onto the engine. When the engine finishes processing one task, it executes the task at the head of the run queue.
After a task begins running on the engine, the engine continues processing it until one of the following events occurs:
The task needs a resource such as a page that is locked by another task, or it needs to perform a slow job such as disk I/O or network I/O. The task is put to sleep, waiting for the resource.
The task runs for a configurable period of time and reaches a yield point. Then the task relinquishes the engine, and the next process in the queue starts to run. “Scheduling client task processing time” discusses in more detail how this works.
When you execute sp_who on a single-CPU system with multiple active tasks, the sp_who output shows only a single task as “running”—it is the sp_who task itself. All other tasks in the run queue have the status “runnable.” The sp_who output also shows the cause for any sleeping tasks.
Figure 3-4 also shows the sleep queue with two sleeping tasks, as well as other objects in shared memory. Tasks are put to sleep while they are waiting for resources or for the results of a disk I/O operation.
Figure 3-4: Tasks queue up for the Adaptive Server engine