MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / update_waiting_time

Method update_waiting_time

scheduling/multi_level_feedback_queue.py:134–148  ·  view source on GitHub ↗

This method updates waiting times of unfinished processes >>> P1 = Process("P1", 0, 53) >>> P2 = Process("P2", 0, 17) >>> P3 = Process("P3", 0, 68) >>> P4 = Process("P4", 0, 24) >>> mlfq = MLFQ(3, [17, 25], deque([P1, P2, P3, P4]), 0) >>> mlfq

(self, process: Process)

Source from the content-addressed store, hash-verified

132 return [q.burst_time for q in queue]
133
134 def update_waiting_time(self, process: Process) -> int:
135 """
136 This method updates waiting times of unfinished processes
137 >>> P1 = Process("P1", 0, 53)
138 >>> P2 = Process("P2", 0, 17)
139 >>> P3 = Process("P3", 0, 68)
140 >>> P4 = Process("P4", 0, 24)
141 >>> mlfq = MLFQ(3, [17, 25], deque([P1, P2, P3, P4]), 0)
142 >>> mlfq.current_time = 10
143 >>> P1.stop_time = 5
144 >>> mlfq.update_waiting_time(P1)
145 5
146 """
147 process.waiting_time += self.current_time - process.stop_time
148 return process.waiting_time
149
150 def first_come_first_served(self, ready_queue: deque[Process]) -> deque[Process]:
151 """

Callers 2

round_robinMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected