150 likes | 313 Views
CS1550 Recitation. Mengmeng Li LMM@cs.pitt.edu Office hours: Wed 2:15-4:45pm, Fri 3:00-4:00pm Office: Sennot Square 6805. goal. Review the CPU scheduling. Exercises. Project 1. motivation.
E N D
CS1550 Recitation Mengmeng Li LMM@cs.pitt.edu Office hours: Wed 2:15-4:45pm, Fri 3:00-4:00pm Office: Sennot Square 6805
goal • Review the CPU scheduling. • Exercises. • Project 1.
motivation • When a computer is multiprogrammed, it frequently has multiple processes or threads competing at the same time. • If only one CPU is available, a choice has to be made which process to run next. • Scheduler: The part of the OS that makes the choice. • Scheduling algorithm:
categories • Preemptive algorithm • Nonpreemptive algorithm
definitions • Throughput: The number of jobs per hour that the system completes • Turnaround time: the statistically average time from the moment that a batch job is submitted until the moment it is completed.
Scheduling in batch systems • First-come first-served Non-preemptive • Shortest job first Non-preemptive • Round Robin Preemptive
First-come first-served • Example 1: Throughput = 60*3/(24+3+3) = 6 Turnaround time = (24 + 26 +28)/3 = 26
First-come first-served • Exercise 1
First-come first-served • Exercise 2
Shortest job first • Example 1: P1 P4 P2 P3 Throughput = 60*4/(10+8+18+3) = 6 Turnaround time = (10 + 3+ 19 + 33)/4 = 17.5
Shortest job first • Exercise 1
Shortest job first • Example 2:
Round Robin • Example Time quantum: 5 • Throughput = 60*4/(10+8+18+3) = 6 • Turnaround = (23+24+33+8)/4 = 22 P1(5) P2(5) P3(5) P4(3) P1(5) P2(3) P3(13)
Round Robin • Exercise
Project 1 • Run the skeleton programs.