Question Details

Processes P1, P2, P3, P4 arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively. Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times. Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?

Options

A

22

B

15

C

37

D

19

Show Answer
Correct Answer
D 19

Solution :

To find the average turnaround time of the processes using the Shortest Remaining Time First (SRTF) CPU scheduling policy, we can construct the scheduling Gantt chart step-by-step.

SRTF is a preemptive scheduling algorithm where the process with the shortest remaining execution time is selected to execute next.

Let's list the processes with their arrival times and burst (execution) times:
- Process P1: Arrival Time = 0 ms, Burst Time = 10 ms
- Process P2: Arrival Time = 1 ms, Burst Time = 13 ms
- Process P3: Arrival Time = 2 ms, Burst Time = 6 ms
- Process P4: Arrival Time = 8 ms, Burst Time = 9 ms

Step-by-Step Execution Trace:
1. At time t = 0 ms:
Only process P1 has arrived. P1 begins execution.
2. At time t = 1 ms:
Process P2 arrives with a burst time of 13 ms. P1 has executed for 1 ms, so its remaining burst time is 10 - 1 = 9 ms. Since P1's remaining time (9 ms) is less than P2's burst time (13 ms), P1 continues executing.
3. At time t = 2 ms:
Process P3 arrives with a burst time of 6 ms. P1 has executed for another 1 ms, so its remaining burst time is 9 - 1 = 8 ms. Comparing the remaining burst times of active processes:
- P1: 8 ms
- P2: 13 ms
- P3: 6 ms
Since P3 has the shortest remaining time (6 ms), P1 is preempted and P3 is scheduled to run.
4. From time t = 2 ms to t = 8 ms:
P3 executes. At t = 8 ms, P3 finishes its execution because its burst time was 6 ms (2 + 6 = 8 ms).
5. At time t = 8 ms:
Process P3 is completed. Process P4 arrives at this exact time with a burst time of 9 ms. Let's compare the remaining times of the active processes:
- P1: 8 ms
- P2: 13 ms
- P4: 9 ms
P1 has the shortest remaining time (8 ms), so P1 resumes execution.
6. From time t = 8 ms to t = 16 ms:
P1 executes for its remaining 8 ms and completes at t = 16 ms (8 + 8 = 16 ms).
7. At time t = 16 ms:
P1 is completed. The remaining processes and their burst times are:
- P2: 13 ms
- P4: 9 ms
P4 has the shorter burst time (9 ms) and is scheduled.
8. From time t = 16 ms to t = 25 ms:
P4 executes for 9 ms and completes at t = 25 ms (16 + 9 = 25 ms).
9. From time t = 25 ms to t = 38 ms:
Only P2 is left. P2 executes for its remaining 13 ms and completes at t = 38 ms (25 + 13 = 38 ms).

Turnaround Time Calculation:
Turnaround Time (TAT) is calculated as:
Turnaround Time (TAT)=Completion Time (CT)-Arrival Time (AT)
Let's find the completion time and turnaround time for each process:
- P1: Completion Time = 16 ms, Arrival Time = 0 ms
TAT of P1=16-0=16 ms
- P2: Completion Time = 38 ms, Arrival Time = 1 ms
TAT of P2=38-1=37 ms
- P3: Completion Time = 8 ms, Arrival Time = 2 ms
TAT of P3=8-2=6 ms
- P4: Completion Time = 25 ms, Arrival Time = 8 ms
TAT of P4=25-8=17 ms

Average Turnaround Time:
Average Turnaround Time=16+37+6+174
Average Turnaround Time=764=19 ms
Thus, the average turnaround time of the four processes is 19 milliseconds.

Transparent Access on Mindyard

Built for Learners & Educators Alike

Completely free for students. Educators & coaching institutes get 2 months free Pro trial to create tests.

FREE FOR STUDENTS

Practice & Learn Free for Students

Access unlimited practice questions, detailed step-by-step solutions, and exam study materials — completely free for students.

  • Unlimited mock tests & question bank practice
  • Full access to curated study library & formula notes
  • 100% free for students • No credit card required
2 MONTHS FREE TRIAL

Educators & Coaching Institutes

Create and conduct professional online assessments with AI question generation, tab proctoring, and comprehensive batch management.

  • AI question uploader & rapid test generator
  • Anti-cheating tab proctoring & performance reports
  • Full Pro access free for 60 days • No upfront commitment
Discover more resources

You may also like

Mock Tests

View All
  • GATE
  • beginner
  • 3 hours
  • civil engineering

Prepare for GATE 2026 Civil Engineering with the latest question papers, previous year papers, detailed solutions, syllabus, exam pattern, preparation tips, mock tests, and subject-wise study material. Download GATE 2026 CE question papers with solutions in PDF format and boost your preparation for top engineering institutes and PSU recruitment.

  • GATE
  • beginner
  • 3 hours
  • electronics and communication engineering

Prepare effectively for GATE 2026 Electronics & Communication Engineering (EC) with this comprehensive Question Paper with Solutions. This resource includes detailed explanations, concept-wise solutions, previous year paper analysis, and exam-oriented practice to help aspirants strengthen core subjects like Electronic Devices, Analog Circuits, Digital Circuits, Signals & Systems, Network Theory, Control Systems, Electromagnetics, Communications, and more. Perfect for revision, self-assessment, and boosting your GATE 2026 EC preparation strategy.

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...
Ask your own doubt or choose a quick prompt: