Scheduling tasks to the engine

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:

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