CS 149: Operating Systems: February 3 Class Meeting
CS 149: Operating Systems: February 3 Class Meeting
A process’s state
information is kept
in its process control
block (PCB).
Running
Actually using the CPU at that instant.
Ready
Runnable, but temporarily stopped to let another process run.
Blocked
Unable to run until some external event happens.
Operating System s: Design and Im plem entation, 3 rd ed.
Computer Science Dept. CS 149: Operating Systems Andrew Tanenbaum & Albert Woodhull 5
Spring 2015: February 3 © R. Mak (c) 2006 Prentice-Hall, Inc. 0-13-142938-8
Process Scheduler
Non-preemptive
The scheduler allows a process to run until it blocks:
Waiting for I/O.
Waiting for another process.
The process voluntarily releases the CPU.
Computer Science Dept. CS 149: Operating Systems 12
Spring 2015: February 3 © R. Mak
Scheduling Criteria
CPU utilization
Keep the CPU as busy as possible.
Throughput
Number of processes that complete their execution
per time unit.
Turnaround time
The amount of elapsed time from when a process
enters the ready queue to when it completes
execution.
Response time
In an interactive environment, the amount of
elapsed time from when a request was submitted
until the first response is produced.
P1 P2 P3
0 24 27 30
Waiting time for P1 = 0; P2 = 24; P3 = 27
Average waiting time: (0 + 24 + 27)/3 = 17
Operating System s Concepts with Java, 8 th edition
Computer Science Dept. CS 149: Operating Systems
Silberschatz, Galvin, and Gagne
17
Spring 2015: February 3 © R. Mak (c) 2010 John Wiley & Sons. All rights reserved. 0-13-142938-8
Shortest Job First (SJF)
Now suppose that the processes arrive in the order:
P2 , P3 , P1 Process Burst Time
P1 24
P2 3
P3 3
The timeline for the schedule is:
P2 P3 P1
0 3 6 30
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
A solution is aging.
As time progresses, the process scheduler
automatically raises the process’s priority.
FCFS P1 P1 P1 P1 P1 P1 P1 P1 P1 P1 P2 P3 P3 P4 P5 P5 P5 P5 P5
SJF P2 P4 P3 P3 P5 P5 P5 P5 P5 P1 P1 P1 P1 P1 P1 P1 P1 P1 P1
HPF P2 P5 P5 P5 P5 P5 P1 P1 P1 P1 P1 P1 P1 P1 P1 P1 P3 P3 P4
RR P1 P2 P3 P4 P5 P1 P3 P5 P1 P5 P1 P5 P1 P5 P1 P1 P1 P1 P1
Turnaround times:
P1 P2 P3 P4 P5
FCFS 10 11 13 14 19
SJF 19 1 4 2 9
HPF 16 1 18 19 6
RR 19 2 7 4 14
32