CPU Scheduling
(Chapter 7)
CS 4410 Operating Systems
[R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]
CPU Scheduling (Chapter 7) CS 4410 Operating Systems [R. Agarwal, - - PowerPoint PPT Presentation
CPU Scheduling (Chapter 7) CS 4410 Operating Systems [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse] The Problem Youre the cook at State Street Diner customers continuously enter and place orders 24 hours a day
[R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]
2
3
4
5
7
Response Time / Latency / Delay Initial Waiting Time
9
10
11
emacs
12
Time 0
12 15 18 Time 0
18 3 6 Time 0
13
14
The Good The Bad The Ugly
15 1 Time 0
2 6 10
16
(1) Tasks (3) (2) (5) (4)
FIFO
(1) Tasks (3) (2) (5) (4)
SJF Time
17
18
The Good The Bad The Ugly
20
(1) Tasks (3) (2) (5) (4)
Round Robin (100 ms time slice)
(1) Tasks (3) (2) (5) (4)
Round Robin (1 ms time slice) Time
Rest of Task 1 Rest of Task 1
21
FIFO and SJF
(1) Tasks (3) (2) (5) (4)
Round Robin (1 ms time slice)
22
Time
(1) Tasks (3) (2) (5) (4)
FIFO and SJF
Tasks of same length that start ~same time
23 I/O Bound Tasks CPU Bound CPU Bound
Time
Issues I/O Request I/O Completes Issues I/O Request I/O Completes
compute go to disk wait 190 ms………….
100 ms quanta 100 ms quanta 100 ms quanta
compute go to disk
24
The Good The Bad The Ugly
25
26
27
System Interactive Batch Student Lowest priority Highest priority
28
Lowest priority Highest priority Quantum = 2 Quantum = 4 Quantum = 8 RR
29
Threads share code & data segments
(pink, green) + Need to synchronize? Other thread is available
+ Improve cache hit ratio
process, schedule threads + Reduce context switching overhead and improve cache hit ratio
30
Time
t1 t2 t3 t4 t1 t2 t3 t4
P1 P2 P3 P4
Time
t1 t2 t3 t4 t1 t2 t3 t4
P1 P2 P3 P4
*multiprocessor only
31