def fcfs_scheduling(processes, n): processes.sort(key=lambda x: x[1]) completion_time = 0 waiting_time = [] turnaround_time = [] for process in processes: pid, arrival_time, burst_time = process if completion_time < arrival_time: completion_time = arrival_time completion_time += burst_time turnaround_time.append(completion_time - arrival_time) waiting_time.append(completion_time - arrival_time - burst_time) print("\nFCFS Scheduling:") for i, process in enumerate(processes): print(f"Process {process[0]}: Waiting Time = {waiting_time[i]}, Turnaround Time = {turnaround_time[i]}") # Input: Process ID, Arrival Time, Burst Time processes = [[1, 0, 5], [2, 1, 3], [3, 2, 8], [4, 3, 6]] fcfs_scheduling(processes, len(processes))