Download presentation
Presentation is loading. Please wait.
Published byΑντιγόνη Αλαβάνος Modified over 6 years ago
1
Lecture 23: Process Scheduling for Interactive Systems
2
Review: Scheduling Algorithms for Batch Systems
First come first serve Shortest job first Shortest remaining time next
3
Review: Scheduling Algorithm Goals
All Systems Fairness – giving each process a fair share of the CPU Policy enforcement – seeing that stated policy is carried out Balance – keeping all parts of the system busy
4
Review: Scheduling Algorithm Goals
Interactive Systems Response time – respond to requests quickly Proportionality – meet users’ expectations
5
Scheduling Algorithms for Interactive Systems
Round-Robin scheduling Priority scheduling Multiple queues Lottery scheduling
6
Round Robin Give CPU time to each process by turn
Quantum = CPU time allotted every turn how to choose the value of the quantum? Too small might mean high context switch overhead Too large might mean bad response times
7
Priority Scheduling Different Priorities:
Background process sending mail vs: Shell process accepting input Requirement: Schedule jobs with highest priority first Issue: high priority jobs should not overwhelm the others Might decrease priority with time
8
Multiple Queues – static version
System level processes High Interactive processes Background processes Low Lower priority queues don’t run if higher priority queues non-empty Could time slice between queues
9
Multiple Queues – dynamic version
High Quantum = 1 Quantum = 2 Low Quantum = 4 Process enters high priority level If takes more than 1 quantum, moved to second highest priority, …..
10
Multiple Queues – dynamic version
Higher priority = faster service, but short service times Reduce number of context switches for long processes
11
Lottery Scheduling Example: 3 processes, priorities 2, 3, 5
Distribute 20, 30, 50 tickets respectively System holds “lottery” 50 times a second Winner gets 20 ms of CPU time Gives probabilistic guarantees
12
RR, Q = 10 Arrival time CPU burst P1: 4 36 8 112 1 13 I/O burst 16
13 16 20 P1: I/O burst P2: P3: P4: Gantt chart
13
RR, Q = 10 13 16 20 P1: P2: P3: P4: Which process goes next, and when? Gantt chart P1 idle P2 P3 P4
14
RR, Q = 10 40 82 47 179 13 16 20 P1: P2: P3: P4: Gantt chart P1 idle P2 P3 P4 P2
15
RR, Q = 10 162 End Run 179 13 16 20 P1: P2: P3: P4: Gantt chart P1 idle P2 P3 P4 P2 P1 P3 P2 P3
16
RR, Q = 10 End 205 179 13 16 20 P1: P2: P3: P4: Gantt chart P1 idle P2 P3 P4 P2 P1 P3 P2 P3 P1 P3 idle
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.