Complete the code to select the process with the highest priority.
highest_priority_process = min(processes, key=lambda p: p[1])
The process with the smallest priority number is selected first in priority scheduling.
Complete the code to check if a process is preempted by a higher priority process.
if new_process.priority [1] current_process.priority:
In priority scheduling, a process with a lower priority number preempts one with a higher number.
Fix the error in the code that calculates waiting time in non-preemptive priority scheduling.
waiting_time = start_time - process[1]Waiting time is the difference between the start time and the arrival time of the process.
Fill both blanks to create a dictionary comprehension that maps process IDs to their priorities for processes with priority less than 5.
{p[1]: p[2] for p in processes if p.priority < 5}This comprehension creates a dictionary with process IDs as keys and their priorities as values, filtering for priorities less than 5.
Fill all three blanks to create a dictionary of processes with their waiting times, only for processes with waiting time greater than 0.
waiting_times = {p[1]: p[2] - p[3] for p in processes if p[2] - p[3] > 0}This dictionary comprehension maps process IDs to their waiting times, calculated as start time minus arrival time, only including positive waiting times.