Write a C program to implement the SJF (Shortest Job First) scheduling algorithm for the given processes as follows:
Burst Time (ms)
Arrival Time (ms)
Process
P1
5
3.5
P2
4
0.0
P3
2
1.5
Your program should do the following:
Initialize an array for arrival time, an array for burst time, and an array for process IDs. Sort the processes based on their arrival time in ascending order.
Calculate the completion time, waiting time, and turnaround time for each process. Display the process details (arrival time, burst time, completion time, waiting time, and turnaround time) for each process.
Display the average waiting time and average turnaround time for all the processes.
Your program should use functions and appropriate data structures to implement the SJF algorithm. Additionally, your program should avoid race conditions using appropriate synchronization techniques.
Submit your Source Code, Results Screen, and a brief write-up explaining the Shortest Job First Algorithm.