Explanation:
In non-preemptive scheduling, once a process starts running, it will continue to run until it completes or blocks. Therefore, the order in which the processes are scheduled can have an impact on the wait time.
To minimize the wait time, we need to consider the expected run times of the processes. The idea is to schedule the shorter processes first, so that they complete quickly and reduce the overall wait time for the longer processes.
Order of Processes:
1. Select the process with the shortest expected run time from the ready queue.
2. Schedule the selected process to run.
3. Repeat steps 1 and 2 until all processes are scheduled.
Based on this approach, let's evaluate the given options:
a) 5, 12, 9, 18
- The process with expected run time 5 is the shortest, so we select it first.
- After the process with run time 5 completes, we have processes with run times 12, 9, and 18 remaining.
- The next shortest process is 9, so we schedule it.
- After the process with run time 9 completes, we have processes with run times 12 and 18 remaining.
- The next shortest process is 12, so we schedule it.
- Finally, we schedule the process with run time 18.
- The order is 5, 9, 12, 18.
c) 12, 18, 9, 5
- The process with expected run time 12 is the longest, so selecting it first would increase the overall wait time.
- Similarly, selecting the process with run time 18 next would also increase the wait time.
- Therefore, this order is not optimal.
d) 9, 12, 18, 5
- This order is similar to option a, but the process with run time 9 is scheduled before the process with run time 12.
- Since the process with run time 12 is shorter, it should be scheduled before the longer process with run time 9.
- Therefore, this order is not optimal.
Conclusion:
The optimal order to minimize the wait time is option b) 5, 9, 12, 18.