Final answer:
The average turnaround time for processes P1, P2, and P3 scheduled using non-preemptive SJF CPU scheduling is approximately 17.33 milliseconds. This was calculated using their respective CPU and I/O burst times under the assumption that each process immediately performs I/O on a separate device after its first CPU burst.
Step-by-step explanation:
The question is about calculating the average turnaround time for three processes P1, P2, and P3 under a non-preemptive Shortest-Job-First (SJF) CPU scheduling policy with separate I/O devices for each process. Since all processes are ready at time = 0 and the system uses SJF scheduling, P1 will run first as it has the shortest CPU burst of 2 ms.
Gantt Chart for CPU:
- Time 0-2ms: P1's first CPU burst
- Time 2-6ms: P2's first CPU burst
- Time 6-11ms: P3's first CPU burst
- Time 12-14ms: P1's second CPU burst (after 10 ms I/O)
- Time 14-18ms: P2's second CPU burst (after 10 ms I/O)
- Time 18-23ms: P3's second CPU burst (after 10 ms I/O)
Assuming each process performs I/O on a separate I/O device immediately after its first CPU burst, the process turnaround times are as follows:
- P1 Turnaround Time: 2ms (1st CPU) + 10ms (I/O) + 2ms (2nd CPU) = 14ms
- P2 Turnaround Time: 4ms (1st CPU) + 10ms (I/O) + 4ms (2nd CPU) = 18ms
- P3 Turnaround Time: 5ms (1st CPU) + 10ms (I/O) + 5ms (2nd CPU) = 20ms
To find the average turnaround time, we add the turnaround times of all processes and divide by the number of processes: (14ms + 18ms + 20ms) / 3 = 52ms / 3 ≈ 17.33ms
Thus, the average turnaround time for the processes is approximately 17.33 milliseconds.