Scheduling engines to the CPU

Figure 3-2 shows a run queue for a single-CPU environment in which process 8 (proc 8) is running on the CPU and processes 6, 1, 7, and 4 are in the operating - system run queue waiting for CPU time. Process 7 is an Adaptive Server process; the others can be any operating - system process.

Figure 3-2: Processes queued in the run queue for a single CPU

In a multitasking environment, multiple processes or subprocesses execute concurrently, alternately sharing CPU resources.

Figure 3-3 shows three subprocesses in a multitasking environment. The subprocesses are represented by the thick, dark arrows pointing down. The subprocesses share a single CPU by switching onto and off the engine over time. They are using CPU time when they are solid – near the arrowhead. They are in the run queue waiting to execute or sleeping while waiting for resources when they are represented by broken lines.

Note that, at any one time, only one process is executing. The others sleep in various stages of progress.

Figure 3-3: Multithreaded processing