11
11
def calculate_waitingtime (
12
12
arrival_time : List [int ], burst_time : List [int ], no_of_processes : int
13
13
) -> List [int ]:
14
-
15
14
"""
16
15
Calculate the waiting time of each processes
17
16
Return: list of waiting times.
@@ -112,7 +111,8 @@ def calculate_average_times(
112
111
for i in range (no_of_processes ):
113
112
total_waiting_time = total_waiting_time + waiting_time [i ]
114
113
total_turn_around_time = total_turn_around_time + turn_around_time [i ]
115
- print ("Average waiting time = %.5f" % (total_waiting_time / no_of_processes ))
114
+ print ("Average waiting time = %.5f" %
115
+ (total_waiting_time / no_of_processes ))
116
116
print ("Average turn around time =" , total_turn_around_time / no_of_processes )
117
117
118
118
@@ -126,15 +126,20 @@ def calculate_average_times(
126
126
for i in range (no_of_processes ):
127
127
print ("Enter the arrival time and brust time for process:--" + str (i + 1 ))
128
128
arrival_time [i ], burst_time [i ] = map (int , input ().split ())
129
- waiting_time = calculate_waitingtime (arrival_time , burst_time , no_of_processes )
129
+
130
+ waiting_time = calculate_waitingtime (
131
+ arrival_time , burst_time , no_of_processes )
132
+
130
133
bt = burst_time
131
134
n = no_of_processes
132
135
wt = waiting_time
133
136
turn_around_time = calculate_turnaroundtime (bt , n , wt )
137
+
134
138
calculate_average_times (waiting_time , turn_around_time , no_of_processes )
135
- processes = list ( range ( 1 , no_of_processes + 1 ))
139
+
136
140
fcfs = pd .DataFrame (
137
- list (zip (processes , burst_time , arrival_time , waiting_time , turn_around_time )),
141
+ list (zip (processes , burst_time , arrival_time ,
142
+ waiting_time , turn_around_time )),
138
143
columns = [
139
144
"Process" ,
140
145
"BurstTime" ,
0 commit comments