Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Operating System - CPU Scheduling

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

OPERATING SYSTEM:CPU SCHEDULING

A.Bathsheba Parimala
Assistant Professor,
Dept.of BCA& M.Sc(NT&IT)
St.John's College,
Palayamkottai
Operating System

An operating system (OS) is a software program that


enables the computer hardware to communicate and
operate with the computer software. Without a computer
operating system, a computer and software programs
would be useless. The popular os are Microsoft Windows,
Apple MacOS, Ubuntu Linux.
It is the change of ready state to running state of the
process. CPU scheduler selects process among the processes
that are ready to execute and allocates CPU to one of them.
Short term scheduler also known as dispatcher, execute most
frequently and makes the fine grained decision of which
process to execute next.
CPU scheduling decisions may take place when a process:
Switches from running to waiting state.
Switches from running to ready state.
Switches from waiting to ready.
Terminates
CPU utilization : keep the CPU as busy as possible.
Turn around Time: amount of time to execute a
particular process.
Waiting time : amount of time a process has been
waiting in the queue.

Response time : amount of time it takes from when a


request was submitted until the first
response is produced not output.
Maximum CPU utilization.
Max throughput.
Minimum turn around time.
Minimum waiting time.
Minimum response time
• First Come First Serve (FCFS) Scheduling
• Shortest-Job-First (SJF) Scheduling
• Priority Scheduling
• Round Robin(RR) Scheduling
• Multilevel Queue Scheduling
First-Come ,First-Served(FCFS)Scheduling

Since CPU gets a lot of processes to handle. So in


FCFS CPU will take the first process in the list and
will process it then it will take the second process
and so on. For example let there be three processes:
PROCESSES BURSTS TIME

P1 24

P2 3

P3 3
Suppose that the processes arrive in order p1,p2,p3
So the waiting time for p1=0,p2=24,p3=27
The average waiting time=(0+24+27)/3=17.
One of the major drawback of this scheme is that the
Average waiting time is often quite long.
It is best approach to minimize waiting time. it
Selects the waiting process with the smallest
execution time to execute next.

Processes Bursts time


P1 6
P2 8
P3 7
P4 3
Average waiting time=(3+16+9+0)/4=7.
The disadvantage of using SJF is that the total
execution time of a job must be known before
execution. while it is not possible to perfectly
predict execution time.
Priority scheduling is a method of scheduling
processes based on priority. In this method the
scheduler chooses the tasks to work as per the
priority.
Processes Burst time Priority
P1 10 3
P2 1 1
P3 2 4
P4 1 5
P5 5 2
Average waiting time=(6+0+16+18+1)/5=8.2
The drawback of priority scheduling is starvation
of low priority process.
In the round robin scheduling, processes are
dispatched in a FIFO manner but are given a
limited amount of CPU time called a time-slice
or a quantum.
If a process does not complete before its CPU-time
expires, the CPU is preempted and given to the
next process waiting in a queue. The preempted
process is then placed at the back of the ready
list.
A CPU Scheduling Mechanism Should
• Favour short jobs.
• Favour I/O bound jobs to get good I/O device
utilization.
• Determine the nature of a job and schedule
accordingly.

You might also like