HomeworkSolutionsCh9x

advertisement
Chapter 9 Homework Solutions
9.1, 9.4, 9.14, 9.16
9.1 Consider the following set of processes:
Process Name
A
B
C
D
E
Arrival Time
0
1
3
9
12
Processing Time
3
5
2
5
5
A
B
0
1
A
B
0
1
C
2
3
D
4
5
6
7
8
C
2
3
9
E
10
11
D
4
5
6
7
8
9
12
13
14
15
16
17
18
19
13
14
15
16
17
18
19
E
10
11
12
Process Name
A
B
C
D
E
Arrival Time
0
1
3
9
12
Processing Time
3
5
2
5
5
Average
9.1 Consider the following set of processes:
Process Name
A
B
C
D
E
Arrival Time
0
1
3
9
12
Processing Time
3
5
2
5
5
A
B
0
1
A
B
0
1
C
2
3
D
4
5
6
7
8
C
2
3
9
E
10
11
D
4
5
6
7
8
9
12
13
14
15
16
17
18
19
13
14
15
16
17
18
19
E
10
11
12
9.4 Favors I/O-bound processes:
If a process uses too much processor time, it will be moved to
a lower-priority queue. This leaves I/O-bound processes in the
higher-priority queues.
9.14 Favors I/O-bound processes:
If a process uses too much processor time, it will be moved to
a lower-priority queue. This leaves I/O-bound processes in the
higher-priority queues.
9.16 Five batch jobs, A through E, arrive at a computer center at
essentially the same time. They have estimated running times
of 15, 9, 3, 6 and 12 minutes, respectively. Their (externally
defined) priorities are 6, 3, 7, 9 and 4, respectively, with lower
value corresponding to higher priorities. For each of the
following scheduling algorithms, determine the turnaround
time for each process and the average turnaround time for all
five jobs. Ignore process switching overhead. Explain how
you arrived at your answers. In the last three cases, assume
that only one job at a time runs until it finishes and that all
jobs are processor bound.
(a) round robin with a time quantum of 1 minute
(b) priority scheduling
(c) FCFS (run in order 15, 9, 3, 6 and 12)
(d) Shortest job next.
(a) round robin with a time quantum of 1 minute
Sequence with which processes will get 1 min of processor time:
The turnaround time for each process:
A = 45 min, B = 35 min, C = 13 min, D = 26 min, E = 42 min
The average turnaround time is
(45+35+13+26+42) / 5 = 32.2 min
(b) Priority scheduling
The average turnaround time is:
(9+21+36+39+45) / 5 = 30 min
(c) FCFS (run in order 15, 9, 3, 6 and 12)
The average turnaround time is:
(15+24+27+33+45) / 5 = 28.8 min
(d) Shortest job next.
The average turnaround time is:
(3+9+18+30+45) / 5 = 21 min
Download