Answer:
A scheduling mechanism called Shortest Job Next (SJN), often referred to as Shortest Job First (SJF), chooses the work with the shortest CPU burst time to be completed next. We must first establish the turnaround time for each work in order to calculate the average turnaround time using SJN. Turnaround time is the sum of the waiting and execution periods from the time the task is delivered until it is finished.
Considering the CPU cycles used by each job:
Job A: 12 ms
Job B: 2 ms
Job C: 15 ms
Job D: 7 ms
Job E: 3 ms
The jobs are arranged using the SJN method in the following order: Job B (2 ms), Job E (3 ms), Job D (7 ms), Job A (12 ms), and Job C. (15 ms)
Now we can figure out how long it will take to complete each job:
Job B: 0 ms (waiting time) + 2 ms (execution time) = 2 ms
Job E: 2 ms (waiting time) + 3 ms (execution time) = 5 ms
Job D: 5 ms (waiting time) + 7 ms (execution time) = 12 ms
Job A: 12 ms (waiting time) + 12 ms (execution time) = 24 ms
Job C: 24 ms (waiting time) + 15 ms (execution time) = 39 ms
By summing all all turnaround times and dividing by the total number of tasks, we can determine the average turnaround time:
(2 ms plus 5 ms plus 12 ms plus 24 ms plus 39 ms) / 5 = 82 ms / 5 = 16.4 ms.
Thus, the SJN algorithm's average turnaround time for all five tasks is 16.4 ms.