Back to the 2019 paper

Module 2: Processes & Scheduling

201914m

Consider the following process :

Process Arrival Time Burst Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4

Considering non-preemptive and preemptive SJF algorithm, find out average waiting time and average turnaround time in both cases.

Worked SolutionAI Assisted

SJF calculations (Arrival+ Burst)

P1 AT0 BT7, P2 AT2 BT4, P3 AT4 BT1, P4 AT5 BT4.
Non-preemptive SJF: At 0: P1 runs 0-7. At 7, ready P2(4),P3(1),P4(4) → P3 7-8, then P2 8-12, P4 12-16. WT: P1 0, P2 6, P3 3, P4 7 → Avg WT=4. Avg TAT = (7+10+4+11)/4=8.
Preemptive SJF (SRTF): 0-2 P1 (rem5), at2 P2 (4 vs5) → P2? Actually P1 rem5 vs P2 4 → preempt to P2 2-4 (rem2), at4 P3(1) arrives shortest → P3 4-5, back to P2 5-7, P4 arrives 5 (4) vs P1(5) → P4 7-11, P1 11-16. WT: P1 9, P2 1, P3 0, P4 2 → Avg WT=3. Avg TAT=7. Details with Gantt: Non-preemptive Gantt P1|P3|P2|P4, Preemptive P1(0-2)|P2(2-4)|P3(4-5)|P2(5-7)|P4(7-11)|P1(11-16).

Similar questions

OPERATING SYSTEMConsider the following process: | Process | Arrival Time | Burst Time | | :--- | :--- | :--- | | P1 | 0.0 | 7 | | P2 | 2.0 | 4 | | P3 | 4.0 | 1 | | P4 | 5.0 | 4 | Considering non-preemptive and preemptive SJF algorithm, find out average waiting time and average turnaround time in both cases.201914mOperating SystemConsider the following set of processes with the length of the CPU burst given in milliseconds: | Process | Burst Time | Priority | | :---: | :---: | :---: | | A | 10 | 3 | | B | 1 | 1 | | C | 2 | 3 | | D | 1 | 4 | | E | 5 | 2 | The processes are assumed to have arrived in order A, B, C, D, E all at time 0. Draw the Gantt charts that illustrate the execution of SJF scheduling algorithm. Show which algorithm results in the minimum average waiting time.20257mOperating SystemConsider the following four processes with following details (time given in ms): | Process | Arrival Time | CPU Burst Time | | :--- | :---: | :---: | | P1 | 0 | 12 | | P2 | 0 | 10 | | P3 | 1 | 4 | | P4 | 4 | 10 | | P5 | 2 | 12 | Draw the Gantt chart using RR scheduling with time slice 3ms. Calculate average waiting time and average turn-around time.20237mOperating SystemConsider the following CPU processes with arrival times 0 and CPU bursts (in milliseconds) as given below: | Process | Burst time | |---|---| | P1 | 24 | | P2 | 3 | | P3 | 3 | If the Round Robin Scheduling is used with time quantum of 4 milliseconds to schedule the processes. Draw the Gantt chart and calculate the average waiting time across all processes (in milliseconds).20227m
Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.