Skip to content

Commit 1fe5136

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5e58b2c commit 1fe5136

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

scheduling/shortest_remaining_time_first.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from statistics import mean
1010

1111

12-
def calculate_waiting_times(burst_times: list[int], arrival_times: list[int]) -> list[int]:
12+
def calculate_waiting_times(
13+
burst_times: list[int], arrival_times: list[int]
14+
) -> list[int]:
1315
"""
1416
Calculate the waiting times of processes using SRTF scheduling.
1517
@@ -39,7 +41,11 @@ def calculate_waiting_times(burst_times: list[int], arrival_times: list[int]) ->
3941
while complete != n:
4042
# Find process with minimum remaining time at current time
4143
for j in range(n):
42-
if arrival_times[j] <= t and remaining_times[j] < min_remaining and remaining_times[j] > 0:
44+
if (
45+
arrival_times[j] <= t
46+
and remaining_times[j] < min_remaining
47+
and remaining_times[j] > 0
48+
):
4349
min_remaining = remaining_times[j]
4450
shortest = j
4551
check = True
@@ -95,4 +101,3 @@ def calculate_turn_around_times(
95101
)
96102
print(f"\nAverage waiting time = {mean(waiting_times):.5f}")
97103
print(f"Average turn around time = {mean(turn_around_times):.5f}")
98-

0 commit comments

Comments
 (0)