scheduling.non_preemptive_shortest_job_first

Non-preemptive Shortest Job First Shortest execution time process is chosen for the next execution. https://www.guru99.com/shortest-job-first-sjf-scheduling.html https://en.wikipedia.org/wiki/Shortest_job_next

Attributes

no_of_processes

Functions

calculate_turnaroundtime(→ list[int])

Calculate the turnaround time of each process.

calculate_waitingtime(→ list[int])

Calculate the waiting time of each processes

Module Contents

scheduling.non_preemptive_shortest_job_first.calculate_turnaroundtime(burst_time: list[int], no_of_processes: int, waiting_time: list[int]) list[int]

Calculate the turnaround time of each process.

Return: The turnaround time for each process. >>> calculate_turnaroundtime([0,1,2], 3, [0, 10, 15]) [0, 11, 17] >>> calculate_turnaroundtime([1,2,2,4], 4, [1, 8, 5, 4]) [2, 10, 7, 8] >>> calculate_turnaroundtime([0,0,0], 3, [12, 0, 2]) [12, 0, 2]

scheduling.non_preemptive_shortest_job_first.calculate_waitingtime(arrival_time: list[int], burst_time: list[int], no_of_processes: int) list[int]

Calculate the waiting time of each processes

Return: The waiting time for each process. >>> calculate_waitingtime([0,1,2], [10, 5, 8], 3) [0, 9, 13] >>> calculate_waitingtime([1,2,2,4], [4, 6, 3, 1], 4) [0, 7, 4, 1] >>> calculate_waitingtime([0,0,0], [12, 2, 10],3) [12, 0, 2]

scheduling.non_preemptive_shortest_job_first.no_of_processes = 4