Upcoming SlideShare
×

# 20

279

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
279
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
6
0
Likes
0
Embeds 0
No embeds

No notes for slide

### 20

1. 1. Understand Process Management• Process Scheduling Algorithms 1
2. 2. HOME PREVIOUS TOPICNEXTPREVIOUS QUESTION PAPERSFOR OSCPP TUTORIALS 2
3. 3. RecapIn the last class, you have learntShortest Job First scheduling algorithm and its -Advantages -Disadvantages 3
4. 4. ObjectivesOn completion of this class, you would be able to know• Priority Scheduling• Round Robin Scheduling 4
5. 5. Priority Scheduling• Priority scheduling algorithm is special case of SJF• A priority is associated with each process• Priorities are indicated by fixed range of numbers• In this scheduling CPU is allocated to the process with the highest priority• Equal priority process scheduled in FCFS order 5
6. 6. Priority Scheduling• Consider the following set of processes assumed to have arrived at time 0, – in order P1,P2,P3-----P5 – with the length of the CPU burst time given in milliseconds – and their associated priorities Process Burst time Priorities P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2 6
7. 7. Priority Scheduling• Using Priority Scheduling we should schedule these processes according to the following Gantt chart P2 P5 P1 P3 P4 0 1 6 16 18 19• The average waiting time is 8.2 milliseconds i.e. (0+1+6+16+18)/5 = 8.2 milliseconds Priority can be defined internally or externally 7
8. 8. Priority Scheduling• Internally defined priorities use some measurable quantity or quantities to compute the priority of a process i.e. – Time limits – Memory requirements – Open files – The ratio of average I/O burst to average CPU burst• Externally priorities are set by criteria process type, work, department sponsoring 8
9. 9. Priority Scheduling• Priority scheduling can be either be Preemptive or Non Preemptive• When a process arrives at the ready queue, its priority is compared with the priority of currently running process• Preempt the CPU if the priority of the newly arrived process is higher than the priority of the currently running processes 10
10. 10. Priority Scheduling• If the priority scheduling algorithm is Non – Preemptive put the new process at the head of the ready queue• A major problem with this is indefinite blocking• A solution to this problem is Aging• Aging is a technique which gradually increases the priority of processes that wait in the system for a long time 11
11. 11. Round-Robin Scheduling Algorithm• The round robin scheduling algorithm is designed especially for Time Sharing Systems• It is similar to FCFS scheduling, but Preemption is added to switch between processes• A small unit of time called Time quantum or time slice is defined• A time quantum is generally from 10 to 100 mille seconds• The CPU scheduler allocates the CPU to each process for a time interval of up to 1 time quantum 12
12. 12. Round-Robin Scheduling Algorithm• The average waiting time under Round Robin policy is often long• Consider the following set of processes that arrive at time 0, with the – length of the CPU burst time given in milliseconds: Process Burst Time P1 24 P2 3 P3 3 13
13. 13. Round-Robin Scheduling Algorithm• Use a time quantum of 4milliseconds• Process P1 gets the first 4msec it is Preempted after the first time quantum• P2 & P3 does not require 4msec they quit before their time quantum 14
14. 14. Round-Robin Scheduling Algorithm• The CPU is returned to process P1• The average waiting time 17 / 3= 5.66milliseconds• The average turn around time for 3 processes of time quantum 10 is 29 15
15. 15. Round-Robin Scheduling Algorithm• Round Robin scheduling is Preemptive• If CPU burst time of process, is larger than the process time quantum then CPU is Preempted from the process• No process is allocated CPU for more than 1 time quantum
16. 16. Round-Robin Scheduling Algorithm• Performance of RR scheduling depends on the size of time quantum• If time quantum is extremely very large RR approach is same as FCFs• If it is extremely small, RR approach is called processor sharing 18
17. 17. SummaryIn this class, you have learnt• Priority Scheduling Algorithm• Round Robin Scheduling 19
18. 18. Frequently Asked Questions1. Explain Round Robin Scheduling2. Explain Priority Scheduling3. What are the Internal & External priorities 20
19. 19. Quiz1. In __________ scheduling CPU allocated to the process with the highest prioritya) FCFSb) SJFc) RRd) Priority 21
20. 20. Quiz2. Priority scheduling can be __________a) Preemptiveb) Non Preemptivec) Bothd) None 22
21. 21. Other subject materials• Web designing• Micro processors• C++ tutorials• javahome
22. 22. Quiz3. RR scheduling is designed for _______ systemsa) Time sharingb) Real timec) Distributedd) None 24
23. 23. Quiz4. If the time quantum is extremely large than RR is same asa) SJFb) FCFSc) Priorityd) None 25
1. #### A particular slide catching your eye?

Clipping is a handy way to collect important slides you want to go back to later.