This method calculates waiting time of 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.mult
(self, queue: list[Process])
| 58 | return sequence |
| 59 | |
| 60 | def calculate_waiting_time(self, queue: list[Process]) -> list[int]: |
| 61 | """ |
| 62 | This method calculates waiting time of processes |
| 63 | >>> P1 = Process("P1", 0, 53) |
| 64 | >>> P2 = Process("P2", 0, 17) |
| 65 | >>> P3 = Process("P3", 0, 68) |
| 66 | >>> P4 = Process("P4", 0, 24) |
| 67 | >>> mlfq = MLFQ(3, [17, 25], deque([P1, P2, P3, P4]), 0) |
| 68 | >>> _ = mlfq.multi_level_feedback_queue() |
| 69 | >>> mlfq.calculate_waiting_time([P1, P2, P3, P4]) |
| 70 | [83, 17, 94, 101] |
| 71 | """ |
| 72 | waiting_times = [] |
| 73 | for i in range(len(queue)): |
| 74 | waiting_times.append(queue[i].waiting_time) |
| 75 | return waiting_times |
| 76 | |
| 77 | def calculate_turnaround_time(self, queue: list[Process]) -> list[int]: |
| 78 | """ |
no test coverage detected