find average turnaround time using preemptive SJF ProcessArrival TimeBurst TimeP108P214P329P435 Select one:a. 13b. 20c. 10d. 14
Question
find average turnaround time using preemptive SJF
Process | Arrival Time | Burst Time |
---|---|---|
P1 | 0 | 8 |
P2 | 1 | 4 |
P3 | 2 | 9 |
P4 | 3 | 5 |
Select one:
a. 13
b. 20
c. 10
d. 14
Solution
To find the average turnaround time using preemptive Shortest Job First (SJF) scheduling, we need to follow these steps:
-
Sort the processes according to their arrival time. If the arrival time is the same, then sort according to the burst time. The process with the shortest burst time will be executed first.
-
Calculate the completion time for each process. The completion time is the time at which a process completes its execution.
-
Calculate the turnaround time for each process. The turnaround time is the difference between the completion time and the arrival time.
-
Calculate the average turnaround time. This is done by adding up all the turnaround times and dividing by the number of processes.
Let's calculate:
-
The processes are already sorted according to their arrival time and burst time.
-
The completion time for each process is as follows:
- P1: 8 (as it arrives at 0 and has a burst time of 8)
- P2: 14 (as it arrives at 1 and has a burst time of 4, but it has to wait for P1 to complete, so 8+4=12, but since P3 arrives at 2 and has a burst time of 9 which is less than the remaining time of P2, P2 will be preempted and will have to wait for P3 to complete. So, 12+9=21. Now, P2 can complete its execution. So, 21+2=23)
- P3: 21 (as it arrives at 2 and has a burst time of 9, but it has to wait for P1 to complete, so 8+9=17)
- P4: 35 (as it arrives at 3 and has a burst time of 5, but it has to wait for P1, P3, and P2 to complete, so 23+5=28)
-
The turnaround time for each process is as follows:
- P1: 8-0 = 8
- P2: 23-1 = 22
- P3: 21-2 = 19
- P4: 35-3 = 32
-
The average turnaround time is (8+22+19+32)/4 = 20.25
So, the closest answer is 20 (option b).
Similar Questions
find average turnaround time using preemptive SJF ProcessArrival TimeBurst TimeP108P214P329P435 Select one:a. 13b. 20c. 10d. 14
find average waiting time using Round Robin (time slice=4ms)? ProcessArrival TimeBurst TimeP108P214P329P435 Select one:a. 12.25b. 11.75c. 11d. 10
Consider the following three processes in the FCFS.Process ID. Brust-time. Arrival-timeP1 3 3P2 6 6P3 9 9What is the average waiting time?2345
What is the overall system average response time in milliseconds, if 2 reqs arrive at S0 per second?
Average waiting time for a customer in the system including average service time is given by the symbol:a.Wqb.Wsc.Pod.Ls
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.