summary
Scheduling: Definitions [53]
long-term scheduler
short-term scheduler
Scheduling: Definitions [54]
CPU-bound
I/O-bound
multilevel scheduling
Performance: Definitions [55]
utilization
throughput
turnaround
Performance: Definitions [56]
response
waiting
important
Performance: Summary [57]
CPU Burst [58]
CPU burst
scanf n, a, b /* I/O wait */
for (i=1; i<=n; i++) /* CPU burst */
x = x + a*b;
printf x /* I/O wait */
for (i=1; i<=n; i++) /* CPU burst */
for (j=1; j<=n; j++)
x = x + a*b;
printf x /* I/O wait */
Scheduling: FCFS [59]
Scheduling: FCFS [60]
| PID | Burst |
| P1 | 24 |
| P2 | 3 |
| P3 | 3 |
| Gantt chart |
| 0242730 |
| PID | Burst |
| P2 | 3 |
| P3 | 3 |
| P1 | 24 |
| Gantt chart |
| 03630 |
Scheduling: Round Robin (RR) [61]
[III.B] Scheduling: RR [62]
| PID | Burst |
| P1 | 24 |
| P2 | 3 |
| P3 | 3 |
| Gantt chart |
| 047101418222630 |
Scheduling: Shortest-Job-First (SJF) [63]
Scheduling: SJF [64]
| PID | Burst |
| P1 | 6 |
| P2 | 8 |
| P3 | 7 |
| P4 | 3 |
| Gantt chart |
| 0391624 |
SJF: Weighted Average Burst [65]
:
:
: recent and past history the same
| time | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|
Burst ( |
6 | 4 | 6 | 4 | 13 | 13 | 13 | |
|
Guess ( |
10 | 8 | 6 | 6 | 5 | 9 | 11 | 12 |
Scheduling: SJF [66]
| PID | Burst | Arrival |
| P1 | 8 | 0 |
| P2 | 4 | 1 |
| P3 | 9 | 2 |
| P4 | 5 | 3 |
| Gantt chart |
| 015101726 |
Scheduling: Priority (PRIO) [67]
Scheduling: PRIO [68]
| PID | Burst | Priority |
| P1 | 10 | 3 |
| P2 | 1 | 1 |
| P3 | 2 | 3 |
| P4 | 1 | 4 |
| P5 | 5 | 2 |
| Gantt chart |
| 0161618 19 |
VOS Scheduling: PRIO, FCFS, SJF [69]
for (i=1; i<=10; i++){ /* 10 CPU BURSTS */
for (j=1;j<=HOWLONG;j++) /* 1 CPU BURST */
pm_busywait(); /* PID1:long PID2:medium PID 3:short*/
pm_yield(); /* GO BACK TO READY QUEUE */
}
| PRIO | FCFS | SJF | ||
| PID | Burst | priority=fixed | priority=equal | priority=1/burst |
| 1 | long | 2 | 1 | low |
| 2 | medium | 3 high | 1 | medium |
| 3 | short | 1 low | 1 | high |
VOS Scheduling: PRIO [70]
===================================== SUMMARY =================================
FREE SUSPENDED READY RUNNING WAITING RECEIVING SLEEPING WRITING READ
PID time cnt time cnt time cnt time cnt time cnt time cnt time cnt time cnt ...
--- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- ---
0 0 1 0 0 72 2 17 3 0 0 0 0 0 0 0 0
1 29 2 1 1 25 11 34 11 0 0 0 0 0 0 0 0
2 64 2 0 1 1 11 24 11 0 0 0 0 0 0 0 0
3 16 2 1 1 58 11 14 11 0 0 0 0 0 0 0 0
4 89 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 89 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
6 89 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 89 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 89 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
9 89 2 0 1 0 1 0 1 0 0 0 0 0 0 0 0
---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- --- ---- ---
TOT 643 14 2 4 156 36 89 37 0 0 0 0 0 0 0 0
Utilization: 80.9 %Busy
Throughput : 2.0 Jobs/Min
Wait Time : 28.0 Sec/Job
Burst Time : 24.0 Sec/Job
VOS Scheduling: PRIO [71]
Scheduling Algorithm: PRIO
>>> SUMMARY (READY) <<< >>>>>>>>>>> SUMMARY (RUNNING) <<<<<<<<<<
PID TOT Wait Time TOT Burst Time / Cnt = Single Burst
=== ============= ============== === ============
1 25 34 11 3.1
2 1 24 11 2.2
3 58 14 11 1.3
Sum Wait Time: 84 /3 Jobs Sum Burst Time: 72 /3 Jobs
Avg Wait Time: 28 Sec/Job Avg Burst Time: 24 Sec/Job
Longest Wait: 58(PID: 3) Longest Single Burst: 3.1(PID: 1)
Shortest Wait: 1(PID: 2) Shortest Single Burst: 1.3(PID: 3)
VOS Scheduling: PRIO [72]
Gantt chart of CPU Usage (Last Scheduler: PRIO)
------------------+-----------+---+-----+---+---+-----+---+--
PID |0 |2 |2 |2 |2 |2 |2 |2
------------------+-----------+---+-----+---+---+-----+---+--
time 9 15 17 20 22 24 27 29
--+-----+---+---+-+-----+-------+-----+-----+-------+-----+--
PID |2 |2 |2 |2|1 |1 |1 |1 |1 |1 |1
--+-----+---+---+-+-----+-------+-----+-----+-------+-----+--
time 31 34 36 3839 42 46 49 52 56 59
------+-----+-----+-------+-+---+-+---+-+-+---+-+---+-+------
PID |1 |1 |1 |1|3 |3|3 |3|3|3 |3|3 |3|3
------+-----+-----+-------+-+---+-+---+-+-+---+-+---+-+------
time 63 66 69 7374 7677 798081 8384 8687
Mechanism (how) vs. Policy (what) [73]
mechanism
policy
Mechanism vs. Policy: Examples [74]
Timer(x sec)
Schedule(job)
Preempt(job)
Remove_From
Ready_Q(job)