In: Computer Science
Task 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Five batch jobs, A through E, arrive at a computer at essentially at the same time.
They have an estimated running time of 15, 9, 3, 6 and 12 minutes, respectively.
Their externally defined priorities are 6, 3, 7, 9 and 4, respectively, with a lower value
corresponding to a higher priority. For each of the following scheduling algorithms,
determine the average turnaround time (TAT). Hint: First you should determine the
schedule, second you should determine the TAT of each job, and in the last step you
should determine the average TAT. Ignore process switching overhead. In the last 3
cases assume that only one job at a time runs until it finishes and that all jobs are
completely processor bound. Explain how you arrive at your answers.
2.1 Round robin with a time quantum of 1 minute (run in order A to E) (1)
2.2 Priority scheduling (1)
2.3 FCFS (run in order A to E) (1)
2.4 Shortest job first (1)
Note: Done accordingly. Please comment for any problem. Please Uprate. Thanks.
Round Robin | ||||
Process | Arrival Time | Burst Time | TAT | Waiting time (TAT-BT) |
A | 0 | 15 | 45 | 30 |
B | 0 | 9 | 35 | 26 |
C | 0 | 3 | 13 | 10 |
D | 0 | 6 | 26 | 20 |
E | 0 | 12 | 42 | 30 |
AVERAGE TAT = | 32.2 min |
Time | Queue | |
0 | A | |
1 | B | |
2 | C | |
3 | D | |
4 | E | |
5 | A | |
6 | B | |
7 | C | |
8 | D | |
9 | E | |
10 | A | |
11 | B | |
12 -->13 | C | C OUT |
13 | D | |
14 | E | |
15 | A | |
16 | B | |
17 | D | |
18 | E | |
19 | A | |
20 | B | |
21 | D | |
22 | E | |
23 | A | |
24 | B | |
25-->26 | D | D OUT |
26 | E | |
27 | A | |
28 | B | |
29 | E | |
30 | A | |
31 | B | |
32 | E | |
33 | A | |
34-->35 | B | B OUT |
35 | E | |
36 | A | |
37 | E | |
38 | A | |
39 | E | |
40 | A | |
41-->42 | E | E OUT |
42 | A | |
43 | A | |
44-->45 | A | A OUT |
Priority Scheduling | |||||||
Process | Priority | Burst Time | TAT | Waiting time (TAT-BT) | |||
A | 6 | 15 | 36 | 36 | |||
B | 3 | 9 | 9 | 9 | |||
C | 7 | 3 | 39 | 39 | |||
D | 9 | 6 | 45 | 45 | |||
E | 4 | 12 | 21 | 21 | |||
QUEUE | |||||||
0 --> 9 | 9 --> 21 | 21 --> 36 | 36-->39 | 39-->45 | AVERAGE TAT = | (36+9+39+45+21)/5 | 30 min |
FCFS | |||||||
Process | Burst Time | TAT | Waiting time (TAT-BT) | ||||
A | 15 | 15 | 0 | ||||
B | 9 | 24 | 15 | ||||
C | 3 | 27 | 24 | ||||
D | 6 | 33 | 27 | ||||
E | 12 | 45 | 33 | ||||
QUEUE | |||||||
0 --> 15 | 15 --> 24 | 24 --> 27 | 27-->33 | 33-->45 | AVERAGE TAT = | (15+24+27+33+45)/5 | 28.8 min |
A | B | C | D | E |
Process | Burst Time | TAT | Waiting time (TAT-BT) | ||||
A | 15 | 45 | 30 | ||||
B | 9 | 18 | 9 | ||||
C | 3 | 3 | 0 | ||||
D | 6 | 9 | 3 | ||||
E | 12 | 30 | 12 | ||||
QUEUE | |||||||
0-->3 | 3-->9 | 9 -->18 | 18-->30 | 30-->45 | AVERAGE TAT = | (45+18+3+9+30)/5 | 21 min |
C | D | B | E | A |