|
|
|
|
|
4th Zilhaj 1435 | Tuesday, Sep 30, 2014
Technical
Aptitude Technical

CPU Scheduling ( Subject: Operating System)

Tuesday, 23 October 2012
Comments(5)

 

Why CPU Scheduling is used?


CPU Scheduling is the process used to maximize the CPU utilization.


CPU Scheduling is done in following circumstances:

 

  • When process switches from the running stage to waiting state
  • When process switches from the running stage to ready state
  • When process switches from the waiting stage to ready state

 

CPU Scheduling is of two types depending on nature

  • Preemptive Scheduling
  • Non –Preemptive Scheduling

 

Preemptive Scheduling

Allows the process to be interrupted in the midst of its execution.


Non –Preemptive Scheduling

Doesnot allows the process to be interrupted in the midst of its execution.


Note: The main aim of the scheduling is to maximize the CPU
When two process are executed simultaneously they are called concurrent process.


Scheduling algorithms


First come, First served (FCFS)


In this scheduling algorithm, the process which comes first are executed first.

Example:

Consider the following example

Process Table
Process Burst Time
P1 19

P2

3
P3 5

 

If the order of the arrival is like in the order shown in the above table, then inorder to schedule using FCFS, first Gantt is plotted.

Gantt Chart
P1 P2 P3

 

Gantt chart denotes the sequence of the exectution of the process. Here sequence of execution is P1,P2,P3.

Waiting time of the process are shown below

P1-----0

P2-----19

P3-----22

Thus, average wating time will be

average waiting waiting time= (0+19+22)/3=13.6


Shortest Job First (SJF)


In this scheduling algorithm, the process with short execution time will be executed first.

 

Example:

Consider the following example

 

Process Table
Process Burst Time
P1 19

P2

3
P3 5

 

If the order of the arrival is like in the order shown in the above table, then inorder to schedule using SJF, first Gantt is plotted.

 

Gantt Chart
P2 P3 P1

 

Gantt chart denotes the sequence of the exectution of the process. Here sequence of execution is P2,P3,P1.

Waiting time of the process are shown below

P1-----8

P2-----0

P3-----3

Thus, average wating time will be

average waiting waiting time= (8+0+3)/3=3.6


Priority Scheduling


In this scheduling algorithm, the process with highest priority process will be executed first, then second highest priority process will be executed, so on at last process with least priority will be executed.

 

Example:

Consider the following example

Process Burst Time  Priority
P1 19 2
P2 3 1
P3 5 3

 

 

If the order of the arrival is like in the order shown in the above table, then inorder to schedule using SJF, first Gantt is plotted.

 

Gantt Chart
P2 P1 P3

 

Gantt chart denotes the sequence of the exectution of the process. Here sequence of execution is P2,P1,P3.

Waiting time of the process are shown below

P1-----3

P2-----0

P3-----22

Thus, average wating time will be

average waiting waiting time= (3+0+22)/3=8.3

 

CPU Scheduling ( Subject: Operating System)

Good notes and clear structure ... helped me a lot...thank u...

This was quite good and

This was quite good and informative.

operating system

thaxs bro it helped me ...

only 3 Algorithms?

There's Round Robin and Multilevel Scheduling too...

TT

This is quite good but it would be better if you try to upload more information related subjects.

Post new comment

To combat spam, please enter the code in the image.

Rs. 26720 (Per 10g)

Opinion Poll
Do you think Satya Nadella's meeting with KCR is a booster for IT in Telangana state?
YesNoCan't say

Matrimony | Photos | Videos | Search | Polls | Archives | Advertise | Letters

© The Siasat Daily, 2012. All rights reserved.
Jawaharlal Nehru Road, Abids, Hyderabad - 500001, AP, India
Tel: +91-40-24744180, Fax: +91-40-24603188
contact@siasat.com