Download presentation
Presentation is loading. Please wait.
1
CHAPTER 2 PROCESSOR SCHEDULING PART III
by Uğur HALICI
2
2.3.2 Shortest-Process-First (SPF)
In this method, the processor is assigned to the process with the smallest execution (processor burst) time. This requires future knowledge of the execution time. In our examples, it is given as a table but actually these burst times are not known by the OS. So it makes prediction. One approach for this prediction is using the previous processor burst times for the processes in the ready queue and then the algorithm selects the shortest predicted next processor burst time.
3
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 SPF RQ: A:4 next_cpu_burst FCFS
4
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8 Proc_id : next_cpu_burst
5
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8 C:2
6
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8 C:2
7
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8
8
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: D:1
9
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: D:1 A:4
10
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: D:1 A:4 C:2
11
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: D:1 A:4 C:2
12
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: A:4 C:2 B:8
13
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: A:4 B:8 D:1
14
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: A:4 B:8 D:1
15
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: A:4 B:8
16
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8 D:1
17
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8 D:1
18
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: B:8
19
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: A:4
20
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ: A:4
21
2.3.2 Shortest-Process-First (SPF)
Arrival time 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec A 4 B 2 8 1 - C 3 D 7 RQ:
22
2.3.2 Shortest-Process-First (SPF)
Processor utilization = (35 / 35) * 100 = 100 % Throughput = 4 / 35 = 0.11
23
2.3.2 Shortest-Process-First (SPF)
Turn around time: tatA = 35 – 0 = 35 tatB = 31 – 2 = 29 tatC = 17 – 3 =14 tatD = 23 – 7 = 16 tatAVG = ( ) / 4 = 23.5
24
2.3.2 Shortest-Process-First (SPF)
Turn around time: tatA = 35 – 0 = 35 tatB = 31 – 2 = 29 tatC = 17 – 3 =14 tatD = 23 – 7 = 16 tatAVG = ( ) / 4 = 23.5
25
2.3.2 Shortest-Process-First (SPF)
Turn around time: tatA = 35 – 0 = 35 tatB = 31 – 2 = 29 tatC = 17 – 3 =14 tatD = 23 – 7 = 16 tatAVG = ( ) / 4 = 23.5
26
2.3.2 Shortest-Process-First (SPF)
Turn around time: tatA = 35 – 0 = 35 tatB = 31 – 2 = 29 tatC = 17 – 3 =14 tatD = 23 – 7 = 16 tatAVG = ( ) / 4 = 23.5
27
2.3.2 Shortest-Process-First (SPF)
Turn around time: tatA = 35 – 0 = 35 tatB = 31 – 2 = 29 tatC = 17 – 3 =14 tatD = 23 – 7 = 16 tatAVG = ( ) / 4 = 23.5
28
2.3.2 Shortest-Process-First (SPF)
Waiting time: wtA = (0 – 0) + (18 – 8) + (31 – 26) = 15 wtB = (6 – 2) + (23 – 15) = 12 wtC = (4 – 3) + (15 – 9) = 7 wtD = (14 – 7) + (17 – 16) + (22 – 19) = 11 wtAVG = ( ) / 4 = 11.25
29
2.3.2 Shortest-Process-First (SPF)
Waiting time: wtA = (0 – 0) + (18 – 8) + (31 – 26) = 15 wtB = (6 – 2) + (23 – 15) = 12 wtC = (4 – 3) + (15 – 9) = 7 wtD = (14 – 7) + (17 – 16) + (22 – 19) = 11 wtAVG = ( ) / 4 = 11.25
30
2.3.2 Shortest-Process-First (SPF)
Waiting time: wtA = (0 – 0) + (18 – 8) + (31 – 26) = 15 wtB = (6 – 2) + (23 – 15) = 12 wtC = (4 – 3) + (15 – 9) = 7 wtD = (14 – 7) + (17 – 16) + (22 – 19) = 11 wtAVG = ( ) / 4 = 11.25
31
2.3.2 Shortest-Process-First (SPF)
Waiting time: wtA = (0 – 0) + (18 – 8) + (31 – 26) = 15 wtB = (6 – 2) + (23 – 15) = 12 wtC = (4 – 3) + (15 – 9) = 7 wtD = (14 – 7) + (17 – 16) + (22 – 19) = 11 wtAVG = ( ) / 4 = 11.25
32
2.3.2 Shortest-Process-First (SPF)
Waiting time: wtA = (0 – 0) + (18 – 8) + (31 – 26) = 15 wtB = (6 – 2) + (23 – 15) = 12 wtC = (4 – 3) + (15 – 9) = 7 wtD = (14 – 7) + (17 – 16) + (22 – 19) = 11 wtAVG = ( ) / 4 = 11.25
33
2.3.2 Shortest-Process-First (SPF)
Response time: rtA = 0 – 0 = 0 rtB = 6 – 2 = 4 rtC = 4 – 3 = 1 rtD = 14 – 7 = 7 rtAVG = ( ) / 4 = 3
34
2.3.2 Shortest-Process-First (SPF)
Response time: rtA = 0 – 0 = 0 rtB = 6 – 2 = 4 rtC = 4 – 3 = 1 rtD = 14 – 7 = 7 rtAVG = ( ) / 4 = 3
35
2.3.2 Shortest-Process-First (SPF)
Response time: rtA = 0 – 0 = 0 rtB = 6 – 2 = 4 rtC = 4 – 3 = 1 rtD = 14 – 7 = 7 rtAVG = ( ) / 4 = 3
36
2.3.2 Shortest-Process-First (SPF)
Response time: rtA = 0 – 0 = 0 rtB = 6 – 2 = 4 rtC = 4 – 3 = 1 rtD = 14 – 7 = 7 rtAVG = ( ) / 4 = 3
37
2.3.2 Shortest-Process-First (SPF)
Response time: rtA = 0 – 0 = 0 rtB = 6 – 2 = 4 rtC = 4 – 3 = 1 rtD = 14 – 7 = 7 rtAVG = ( ) / 4 = 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.