Knowee
Questions
Features
Study Tools

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 ProcessArrival TimeBurst TimeP108P214P329P435 Select one:a. 13b. 20c. 10d. 14

🧐 Not the exact question you are looking for?Go ask a question

Solution

To find the average turnaround time using preemptive Shortest Job First (SJF) scheduling, we need to follow these steps:

  1. 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.

  2. Calculate the completion time for each process. The completion time is the time at which a process completes its execution.

  3. Calculate the turnaround time for each process. The turnaround time is the difference between the completion time and the arrival time.

  4. 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:

  1. The processes are already sorted according to their arrival time and burst time.

  2. 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)
  3. 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
  4. The average turnaround time is (8+22+19+32)/4 = 20.25

So, the closest answer is 20 (option b).

This problem has been solved

Similar Questions

Suppose that the following processes arrive for execution at the times indicated.Each process will run for the amount of time listed. In answering the questions, usenonpreemptive scheduling, and base all decisions on the information you have at the timethe decision must be made.Process Arrival Time Burst TimeP1 0.0 8P2 0.4 4P3 1.0 1a. What is the average turnaround time for these processes with the FCFSscheduling algorithm?b. What is the average turnaround time for these processes with theSJF scheduling algorithm?c. The SJF algorithm is supposed to improve performance, but notice that we choseto run process P1 at time 0 because we did not know that two shorter processes wouldarrive soon. Compute what the average turnaround time will be if the CPU is left idle forthe first 1 unit and then SJF scheduling is used. Remember that processes P1 and P2 arewaiting during this idle time, so their waiting time may increase. This algorithm could becalled future-knowledge scheduling.Exercises 3.Consider the following set of processes, with the length of the CPU burstgiven in milliseconds:Process Burst Time PriorityP1 2 2P2 1 1P3 8 4P4 4 2P5 5 3

find average waiting time using Round Robin (time slice=4ms)? ProcessArrival TimeBurst TimeP108P214P329P435 Select one:a. 12.25b. 11.75c. 11d. 10

find average turnaround time using FCFSProcess Arrival Time Burst Time wt tat ctP1 0 8 0 8 8P2 1 4 7 11 12P3 2 9 10 19 21P4 3 5 18 23 26Formula usedTATi = Wti + BTiCTi = TATiCTi+1 = Cti + BTi+iWti+1=CTi-ATi+1

Solve following example by FCFS and SJF CPU schedulingalgorithm. Draw Gantt Chart and calculate Average Waiting Timeand Average Turnaround time.Process Arrival Time Burst TimeP0 0 10P1 1 6P2 3 2P3 5 4

Consider Five Processes P1 to P5 arrived at same time. They have stimated runningtime 10,2,6,8 and 4 seconds, respectively. Their Priorities are 3,2,5,4 and 1,respectively with 5 being highest Priority. Find the average turnaround time andaverage waiting time for Round- Robin(q=3) and Priority Schedulingalgorithm.

1/2

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.