-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex3.txt
101 lines (97 loc) · 1.75 KB
/
ex3.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Same input for all three algorithms:
7 processes: (0,1), (0,1), (0,1), (7, 1), (3,3), (3, 1), (3, 2)
For round robin alorithm let's make quantum equals 2 (because maximum bust time in this example is 3, so if we make quantum >= 3, we will not able to see, how interraptions work)
Output of FIFS algorithm:
Process 0 (0, 1):
CT = 0
TAT = 1
WT = 0
Process 1 (0, 1):
CT = 1
TAT = 2
WT = 1
Process 2 (0, 1):
CT = 2
TAT = 3
WT = 2
Process 3 (7, 1):
CT = 0
TAT = 1
WT = 0
Process 4 (3, 3):
CT = 5
TAT = 8
WT = 5
Process 5 (3, 1):
CT = 8
TAT = 9
WT = 8
Process 6 (3, 2):
CT = 9
TAT = 11
WT = 9
Average TAT = 5.000000
Average WT = 3.571429
Output of SJF algorithm:
Process 0 (0, 1):
CT = 0
TAT = 1
WT = 0
Process 1 (0, 1):
CT = 1
TAT = 2
WT = 1
Process 2 (0, 1):
CT = 2
TAT = 3
WT = 2
Process 3 (3, 1):
CT = 0
TAT = 1
WT = 0
Process 4 (3, 2):
CT = 1
TAT = 3
WT = 1
Process 5 (3, 3):
CT = 3
TAT = 6
WT = 3
Process 6 (7, 1):
CT = 2
TAT = 3
WT = 2
Average TAT = 2.714286
Average WT = 1.285714
Output of round robin algorithm (quantum = 2):
Process 0:
CT = 0
TAT = 1
WT = 0
Process 1:
CT = 1
TAT = 2
WT = 1
Process 2:
CT = 2
TAT = 3
WT = 2
Process 3:
CT = 0
TAT = 1
WT = 0
Process 4:
CT = 1
TAT = 3
WT = 1
Process 5:
CT = 3
TAT = 7
WT = 4
Process 6:
CT = 1
TAT = 2
WT = 1
Average TAT = 2.428571
Average WT = 1.285714
At round robin algorithm we can see changes at CT, TAT, and WT at last two processes and decreasing of average TAT. The longest process wait less, than in SJF algorithm, because of quantum.