We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96be592 commit 640422bCopy full SHA for 640422b
1 file changed
scheduling/fcfs.py
@@ -1,5 +1,6 @@
1
from collections import deque
2
3
+
4
# ---------------- FCFS ----------------
5
def fcfs(processes, burst_time):
6
n = len(processes)
@@ -8,7 +9,7 @@ def fcfs(processes, burst_time):
8
9
10
# Calculate waiting time
11
for i in range(1, n):
- waiting_time[i] = waiting_time[i-1] + burst_time[i-1]
12
+ waiting_time[i] = waiting_time[i - 1] + burst_time[i - 1]
13
14
# Turnaround time = waiting + burst
15
for i in range(n):
@@ -17,6 +18,8 @@ def fcfs(processes, burst_time):
17
18
avg_wt = sum(waiting_time) / n
19
avg_tat = sum(turnaround_time) / n
20
return waiting_time, turnaround_time, avg_wt, avg_tat
21
22
23
if __name__ == "__main__":
24
processes = [1, 2, 3]
25
burst_time = [5, 9, 6]
0 commit comments