Knowee
Questions
Features
Study Tools

find average turnaround time using preemptive SJF ProcessArrival TimeBurst TimeP108P214P329P435

Question

find average turnaround time using preemptive SJF ProcessArrival TimeBurst TimeP108P214P329P435

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

Solution

Sure, here is how you can calculate the average turnaround time using preemptive Shortest Job First (SJF) scheduling algorithm:

  1. First, sort the processes according to their arrival time. If the arrival time is the same, then sort according to the burst time. The sorted list is as follows:

    Process Arrival Time Burst Time
    P1 0 8
    P2 1 4
    P3 2 9
    P4 3 5
  2. Now, start executing the processes. At time 0, only P1 has arrived, so execute P1. At time 1, P2 arrives. Since P2 has a shorter burst time than the remaining burst time of P1, preempt P1 and execute P2.

  3. At time 5, P2 finishes execution. Now, choose the next process with the shortest burst time. Both P1 and P3 have arrived, but P1 has a shorter remaining burst time, so execute P1.

  4. At time 8, P1 finishes execution. Now, choose the next process with the shortest burst time. Both P3 and P4 have arrived, but P4 has a shorter burst time, so execute P4.

  5. At time 13, P4 finishes execution. Now, only P3 is left, so execute P3. At time 22, P3 finishes execution.

  6. Now, calculate the turnaround time for each process. The turnaround time is the time from the arrival of the process to the completion of the process.

    Process Arrival Time Completion Time Turnaround Time
    P1 0 8 8
    P2 1 5 4
    P3 2 22 20
    P4 3 13 10
  7. Finally, calculate the average turnaround time. The average turnaround time is the total turnaround time divided by the number of processes.

    (8 + 4 + 20 + 10) / 4 = 10.5

So, the average turnaround time using preemptive SJF scheduling algorithm is 10.5.

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

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

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/3

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.