Discussion
Consider a single processor system with four processes A, B, C, and D, represented as given below, where for each process the first value is its arrival time, and the second value is its CPU burst time.
A (0, 10), B (2, 6), C (4, 3), and D (6, 7).
Which one of the following options gives the average waiting times when preemptive Shortest Remaining Time First (SRTF) and Non-Preemptive Shortest Job First (NP-SJF) CPU scheduling algorithms are applied to the processes?
Answer: B
The average waiting times are SRTF = 6, NP-SJF = 7.5.
SRTF. A runs 0-2. B arrives with 6 against A's remaining 8 and runs 2-4. C arrives with 3 against B's remaining 4 and runs 4-7 (D, arriving at 6 with 7, does not preempt C's remaining 1). Then B runs 7-11, D 11-18 and A 18-26. Waiting time is finish minus arrival minus burst: A 16, B 3, C 0, D 5, total 24, average 6.
NP-SJF. A runs 0-10 without interruption. At 10, C (3) is shortest and runs 10-13, then B (6) 13-19, then D (7) 19-26. Waiting times: A 0, C 6, B 11, D 13, total 30, average 7.5.
The other options get one of the two schedules wrong: 7 for SRTF, or 7 and 8.5 for NP-SJF, do not match these timelines.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development