Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  An operating system uses shortest remaining t... Start Learning for Free
An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):
Process   Arrival Time    Burst Time
  P1           0                    12
  P2           2                     4
  P3           3                     6
  P4           8                     5
The average waiting time (in milliseconds) of the processes is _________.
  • a)
    4.5
  • b)
    5.0
  • c)
    5.5
  • d)
    6.5
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
An operating system uses shortest remaining time first scheduling algo...
Process   Arrival Time   Burst Time
  P1           0                   12
  P2           2                    4
  P3           3                    6
  P4           8                    5
Burst Time - The total time needed by a process from the CPU for its complete execution. Waiting Time - How much time processes spend in the ready queue waiting their turn to get on the CPU Now, The Gantt chart for the above processes is :
P1 - 0 to 2 milliseconds
P2 - 2 to 6 milliseconds
P3 - 6 to 12 milliseconds
P4 - 12 to 17 milliseconds
P1 - 17 to 27 milliseconds 
Process p1 arrived at time 0, hence cpu started executing it. After 2 units of time P2 arrives and burst time of P2 was 4 units, and the remaining time of the process p1 was 10 units,hence cpu started executing P2, putting P1 in waiting state(Pre-emptive and Shortest remaining time first scheduling). Due to P1's highest remaining time it was executed by the cpu in the end.
Now calculating the waiting time of each process:
P1 -> 17 -2 = 15
P2 -> 0
P3 -> 6 - 3 = 3
P4 -> 12 - 8 = 4 
Hence total waiting time of all the processes is 
= 15+0+3+4=22
Total no of processes = 4
Average waiting time = 22 / 4 = 5.5
Hence C is the answer. 
View all questions of this test
Most Upvoted Answer
An operating system uses shortest remaining time first scheduling algo...
Process   Arrival Time   Burst Time
  P1           0                   12
  P2           2                    4
  P3           3                    6
  P4           8                    5
Burst Time - The total time needed by a process from the CPU for its complete execution. Waiting Time - How much time processes spend in the ready queue waiting their turn to get on the CPU Now, The Gantt chart for the above processes is :
P1 - 0 to 2 milliseconds
P2 - 2 to 6 milliseconds
P3 - 6 to 12 milliseconds
P4 - 12 to 17 milliseconds
P1 - 17 to 27 milliseconds 
Process p1 arrived at time 0, hence cpu started executing it. After 2 units of time P2 arrives and burst time of P2 was 4 units, and the remaining time of the process p1 was 10 units,hence cpu started executing P2, putting P1 in waiting state(Pre-emptive and Shortest remaining time first scheduling). Due to P1's highest remaining time it was executed by the cpu in the end.
Now calculating the waiting time of each process:
P1 -> 17 -2 = 15
P2 -> 0
P3 -> 6 - 3 = 3
P4 -> 12 - 8 = 4 
Hence total waiting time of all the processes is 
= 15+0+3+4=22
Total no of processes = 4
Average waiting time = 22 / 4 = 5.5
Hence C is the answer. 
Free Test
Community Answer
An operating system uses shortest remaining time first scheduling algo...
Explanation:

To calculate the average waiting time using the shortest remaining time first (SRTF) scheduling algorithm, we need to follow these steps:

Step 1: Sort the processes based on their arrival time in ascending order.

The sorted order of the processes based on arrival time is:
P1, P2, P3, P4

Step 2: Initialize the time counter and a variable to store the total waiting time.

Let's assume the current time is 0 and the total waiting time is 0.

Step 3: Execute the processes one by one based on their burst time.

Start executing process P1 (as it has the shortest burst time).

At time 0, P1 arrives and starts executing. It completes its execution at time 12. The waiting time for P1 is 0.

Now, the remaining processes are P2, P3, and P4.

Step 4: Calculate the waiting time for the remaining processes.

At time 12, P2 arrives. The remaining burst time for P1 is 0, so it is not considered. The remaining burst time for P2 is 4, and the waiting time for P2 is 12 - 2 = 10.

At time 14, P3 arrives. The remaining burst time for P2 is 2, and the remaining burst time for P3 is 6. Since P2 has a shorter remaining burst time, it continues to execute. The waiting time for P3 is 14 - 3 = 11.

At time 17, P4 arrives. The remaining burst time for P2 is 0, so it is not considered. The remaining burst time for P3 is 3, and the remaining burst time for P4 is 5. Since P3 has a shorter remaining burst time, it continues to execute. The waiting time for P4 is 17 - 8 = 9.

Step 5: Calculate the average waiting time.

The total waiting time is 0 + 10 + 11 + 9 = 30.

The average waiting time is 30 / 4 (number of processes) = 7.5 ms.

So, the average waiting time (in milliseconds) of the processes is 7.5 ms.

Since the options provided are in integer values, we round down the average waiting time to the nearest integer.

Hence, the correct answer is option C) 5.
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer?
Question Description
An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer?.
Solutions for An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer?, a detailed solution for An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their arrival times and CPU burst times (in milliseconds):Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5The average waiting time (in milliseconds) of the processes is _________.a)4.5b)5.0c)5.5d)6.5Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev