OPERATING SYSTEM
CS(407)
LECTURE 5
PROCESS SCHEDULING
INSTRUCTOR
SIBGHA ZIA
DEPARTMENT OF COMPUTER SCIENCE
UAF SUB CAMPUS BUREWALA
PROCESS SCHEDULING
Process scheduling is a technique used
When there are limited recourses and many processes are competing for them.
Process scheduling is an essential part of a Multiprogramming operating
systems. Multiprogramming ensures that there is some process running at all the time.
This is done to utilize the CPU as much as possible.
In time sharing system , the CPU switches so frequently between jobs that the user
does not feel that the machine is being shared by many processes or even many users.
If the system has more than one processor, then it is possible to execute more than
one process at the same time.
In single processor system, only one process can be executed at any given time.
If there are more processes than processors, then the operating system must
schedule processes . It means that some process will be executed and other will
have to wait.
There are many strategies for deciding which process should be assigned the CPU.
SCHEDULING QUEUES
The Operating System maintains the following important process scheduling
queues
Job queue − This queue keeps all the processes in the system.
Ready queue − This queue keeps a set of all processes residing in main
memory, ready and waiting to execute. A new process is always put in this
queue.
Waiting queues − The processes which are blocked due to unavailability of an
I/O device constitute this queue.
PROCESS MIGRATION BETWEEN VARIOUS QUEUES
During its life time, a process begin in the job queue. It moves between the ready,
waiting and possibly job queues and eventually finishes the task. The process of
moving between various queues is known as process migration
SCHEDULER
A process is placed in different scheduling queues throughout its life time.
The operating system must select the processes from these queues in some way
for scheduling purpose. The part of operating system related to this decision is
called the scheduler. The algorithm used by scheduler is called the scheduling
algorithm.
Schedulers are of three types −
Long-Term Scheduler
Short-Term Scheduler
Medium-Term Scheduler
LONG-TERM SCHEDULER
Long term scheduler is also known as a job scheduler.
This scheduler regulates the program and select process from the job queue to
the ready queue in main memory.
The long term scheduler controls the number of processes in memory also known
as the degree of multiprogramming.
If the degree of multiprogramming is stable, then the average rate of process
creation must be equal to the average departure rate of processes leaving the
system.
The system slows down if too many processes are loaded into the memory.
The long term scheduler invoked only when a process leaves the system. it then
decides the next process to be executed.
However, the main goal of this type of scheduler is to offer a balanced mix of jobs,
like Processor, I/O jobs., that allows managing multiprogramming.
SHORT-TERM SCHEDULER
Short term scheduling is also known as CPU scheduler.
It selects a process from ready queue and allocates CPU to that process for
execution.
The short term scheduler is invoked very frequently and must be very fast. A process
is typically allocated the CPU for a very short period of time.
Short-term schedulers, also known as dispatchers, make the decision of which
process to execute next.
Short-term schedulers makes decisions much more frequently than long term and
mid term schedulers.
Long term and short term scheduling
MEDIUM TERM SCHEDULER
Medium-term scheduling is a part of swapping.
It removes the processes from the memory. It reduces the degree of
multiprogramming.
The medium-term scheduler is in-charge of handling the swapped out-processes.
A running process can become suspended if it makes an I/O request. A suspended
processes can’t make any progress towards completion. In order to remove the
process from memory and make space for other processes, the suspended process
should be moved to secondary storage
ADDITION OF MEDIUM TERM SCHEDULING