Skip to content

Commit 640422b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 96be592 commit 640422b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scheduling/fcfs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections import deque
22

3+
34
# ---------------- FCFS ----------------
45
def fcfs(processes, burst_time):
56
n = len(processes)
@@ -8,7 +9,7 @@ def fcfs(processes, burst_time):
89

910
# Calculate waiting time
1011
for i in range(1, n):
11-
waiting_time[i] = waiting_time[i-1] + burst_time[i-1]
12+
waiting_time[i] = waiting_time[i - 1] + burst_time[i - 1]
1213

1314
# Turnaround time = waiting + burst
1415
for i in range(n):
@@ -17,6 +18,8 @@ def fcfs(processes, burst_time):
1718
avg_wt = sum(waiting_time) / n
1819
avg_tat = sum(turnaround_time) / n
1920
return waiting_time, turnaround_time, avg_wt, avg_tat
21+
22+
2023
if __name__ == "__main__":
2124
processes = [1, 2, 3]
2225
burst_time = [5, 9, 6]

0 commit comments

Comments
 (0)