350 Computer Architecture and Organization
operation of the process. We should remember that any process is executed in steps. Therefore, it
is frequently released from the processor before getting another chance to be executed again. As it
must restart from the same place it was terminated during its last execution, the value of the program
counter is always stored within the PCB when the process had to leave the processor halfway through
its execution.
11.2.4 Movements of a Process
The schematic presented in Figure 11.2 should not create the illusion that a process hops and jumps
from one point to another several times till the end of its execution. As a matter of fact, any process is
moved (copied to main memory from a disc) only once and till the end of its execution it stays at the
same location of the main memory. The movement from long-term to short-term queue is performed by
changing two related lists within the OS rather than physically shifting the program codes from one part
of memory to another. Similarly, the program counter of the processor is loaded with the current starting
memory address of the process to begin its execution and the program counter is loaded by the address
of the next process to stop the execution of the previous process. The I/O wait queue is also another list,
maintained by the OS, which may include and delete the process number as per the system requirement.
We should also note that all related details of the current phase are also stored within the process control
block for future use and reference.
11.3 SCHEDULING ISSUES
Scheduling is the term indicating the method to decide which process would be executed next by the
processor. The whole procedure of scheduling is overseen by the scheduler of the operating system. The
scheduler looks after or manages various queues, oversees that the processor and other resources are
properly utilized, and loads the processor at the appropriate moments with a selected process. Initially, it
does not seem to be a dif cult duty. Apparently, it is expected to maintain a few queues and by generat-
ing interrupts at regular intervals (depending upon the duration of the allotted time-slices to processes),
it needs to save the current program counter value within the PCB of the discarded process and load the
PC of the processor by the program counter value of the next process to be started. However, the matter
is more complex than that it seems to be, apparently.
11.3.1 CPU-bound and I/O-bound Processes
If we closely observe the programs executed by computers, we would conclude that they are one of the
two types CPU-bound or I/O-bound . A CPU-bound program needs more CPU time and its demand for I/O
time is negligible. On the other hand, an I/O-bound program demands more I/O time than the CPU time.
As example cases, we may consider two programs. The rst one is to solve a set of simultaneous equa-
tions and the second one is an on-screen animation program. Evidently, the rst program would keep the
CPU busy till it solved the problem and nally demand the I/O to display the results. On the other hand,
the animation program would keep on fetching and displaying graphics and would demand very less CPU
time. In our daily life, we rarely encounter any program that demands a balanced attention of CPU and I/O.
If the scheduler continues to send CPU-bound processes, then the I/O queue would remain almost
empty and the processor would be heavily loaded. Conversely, the CPU may remain idle and the I/O
M11_GHOS1557_01_SE_C11.indd 350M11_GHOS1557_01_SE_C11.indd 350 4/29/11 5:21 PM4/29/11 5:21 PM