You are on page 1of 5

17CS61

 Lab No : 08 Implementing CPU Scheduling Algorithm

a) What do you mean by context switching ?

It involves storing the context or state of a process so that it can be reloaded when
required and execution can be resumed from the same point as earlier. This is a feature
of a multitasking operating system and allows a single CPU to be shared by multiple
processes.

b) Execute all above implementations (FCFS, SJF, Priority Based and RR) and
attach the snapshots.

Manual Examples:


17CS61
17CS61
17CS61

c) How to evaluate scheduling algorithm ?

The first thing we need to decide is how we will evaluate the algorithms. To do this
we need to decide on the relative importance of the factors which include Fairness,
Efficiency, Response Times, Turnaround and Throughput. Only once we have
decided on our evaluation method can we carry out the evaluation.

d) Give a non-computer example of preemptive and non-preemptive scheduling ?

Consider any system where people use some kind of resources and compete for
them. The non-computer examples for preemptive scheduling the traffic on the single
lane road if there is emergency or there is an ambulance on the road the other
vehicles give path to the vehicles that are in need. The example for preemptive
scheduling is people standing in queue for tickets.
e) What are the different functions of Scheduler and how to make it efficient?

Main Function of a Scheduler: It selects processes from the queue and loads them
into memory for execution. Process loads into the memory for CPU scheduling. The
primary objective of the job scheduler is to provide a balanced mix of jobs, such as
I/O bound and processor bound.
How to make it efficient:
No resource starvation problems
Very high predictability; allows implementation of hard real-time systems
Almost no overhead
May not be optimal for all applications
Effectiveness is completely dependent on the implementation

f) What is a long-term scheduler & short-term scheduler ?


17CS61

Long Term Scheduler


It is also called a job scheduler. A long-term scheduler determines which programs
are admitted to the system for processing. It selects processes from the queue and
loads them into memory for execution. Process loads into the memory for CPU
scheduling.

The primary objective of the job scheduler is to provide a balanced mix of jobs, such
as I/O bound and processor bound. It also controls 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.

Short Term Scheduler


It is also called as CPU scheduler. Its main objective is to increase system
performance in accordance with the chosen set of criteria. It is the change of ready
state to running state of the process. CPU scheduler selects a process among the
processes that are ready to execute and allocates CPU to one of them.

Short-term schedulers, also known as dispatchers, make the decision of which


process to execute next. Short-term schedulers are faster than long-term schedulers.

You might also like