ü The objective of multiprogramming is to have some process running at all times, so as to maximize CPU utilization.
ü Scheduling Queues
There are 3 types of scheduling queues .They are :
ü Job Queue
ü Ready Queue
ü Device Queue
ü As processes enter the system, they are put into a job queue.
ü The processes that are residing in main memory and are ready and waiting to execute are kept on a list called the ready queue.
ü The list of processes waiting for an I/O device is kept in a device queue for that particular device.
ü A new process is initially put in the ready queue. It waits in the ready queue until it is selected for execution (or dispatched).
ü Once the process is assigned tothe CPU and is executing, one of several events could occur:
o The process could issue an I/O request, and then be placed in an I/O queue.
o The process could create a new subprocess and wait for its termination.
ü The process could be removed forcibly from the CPU, as a result of an interrupt, and be put back in the ready Queue.
ü A common representation of process scheduling is a queueing diagram.
ü A process migrates between the various scheduling queues throughout its lifetime.
ü The operating system must select, for scheduling purposes, processes from these queues in some fashion.
ü The selection process is carried out by the appropriate scheduler.
ü There are three different types of schedulers.They are:
1. Long-term Scheduler or Job Scheduler
2. Short-term Scheduler or CPU Scheduler
3. Medium term Scheduler
The long-term scheduler, or job scheduler, selects processes from this pool and loads them into memory for execution. It is invoked very in frequently. It controls the degree of multiprogramming.
The short-term scheduler, or CPU scheduler, selects from among the processes that are ready to execute, and allocates the CPU to one of them. It is invoked very frequently.
o Processes can be described as either I/O bound or CPU bound.
o An I\O-bound process spends more of its time doing I/O than it spends doing computations.
o A CPU-bound process, on the other hand, generates I/O requests infrequently, using more of its time doing computation than an I/O-bound process uses.
p The system with the best performance will have a combination of CPU-bound and I/O-bound processes.
The Medium term Scheduler
o Some operating systems, such as time-sharing systems, may introduce an additional, intermediate level of scheduling.
o The key idea is medium-term scheduler, removes processes from memory and thus reduces the degree of multiprogramming.
ü At some later time, the process can be reintroduced into memory and its execution can be continued where it left off. This scheme is called swapping.