Skip to content

Commit

Permalink
fixed time calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
AnkushSinghGandhi committed Apr 9, 2024
1 parent 8a608a6 commit 31b3d69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rr_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def schedule(self, processes):
if remaining_burst_time[i] > self.time_quantum:
self.current_time += self.time_quantum
remaining_burst_time[i] -= self.time_quantum
waiting_times[i] = max(0, self.current_time - process.arrival_time - process.burst_time)
waiting_times[i] += self.current_time - process.arrival_time # Update waiting time
else:
self.current_time += remaining_burst_time[i]
waiting_times[i] = max(0, self.current_time - process.arrival_time - remaining_burst_time[i])
waiting_times[i] += self.current_time - process.arrival_time - remaining_burst_time[i] # Update waiting time
remaining_burst_time[i] = 0
process_turnaround_time = self.current_time - process.arrival_time
self.total_turnaround_time += process_turnaround_time
Expand Down

0 comments on commit 31b3d69

Please sign in to comment.