Solve these Unsolved Questions on CPU Scheduling Algorithms to check out your understanding on the same

Q1. Find the av. waiting time and av. turnaround time using:

a) FCFS

b) SJF(NP)

c) SJF(P)

d) RR (TQ=3)

Process | Burst Time | Arrival Time |

P1 | 2 | 2 |

P2 | 6 | 5 |

P3 | 4 | 0 |

P4 | 7 | 0 |

P5 | 4 | 7 |

Q2. Find the av. waiting time and av. turnaround time using:

a) SJF(NP)

b) SJF(P)

PROCESS | BURST TIME | ARRIVAL TIME |

P1 | 3 | 2 |

P2 | 5 | 0 |

P3 | 3 | 1 |

P4 | 4 | 6 |

Q3. Find the av. waiting time and av. turnaround time using:

a) Priority(NP)

b) Priority(P)

PROCESS | BURST TIME | ARRIVAL TIME | Priority |

P1 | 3 | 2 | 1 |

P2 | 5 | 0 | 3 |

P3 | 3 | 1 | 2 |

P4 | 4 | 6 | 1 |

Q4. [GATE-2006] Consider three CPU-intensive processes, which require 10, 20 and 30 time units and arrive at times 0, 2 and 6, respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end.

(a) 1 (b) 2 (c) 3 (d) 4

Q5. [GATE-2006] Consider three processes (process id 0, 1, 2 respectively) with compute time bursts 2, 4 and 8 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is:

(a) 13 units (b) 14 units (c) 15 units (d) 16 units

Q6. [GATE-2007] An operating system uses Shortest Remaining Time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes:

Process Execution time Arrival time P1 20 0 P2 25 15 P3 10 30 P4 15 45

What is the total waiting time for process P2?

(a) 5 (b) 15 (c) 40 (d) 55

SakethQ1) a) FCFS: Avg WT- 6.6

b)SJF(NP): Avg WT- 4.8

Q2) a) SJF(NP):Avg WT- 3.75

AWow thank you for your generous contribution

Baljit Singh SainiWell Done. Share answers for other questions also

HimanshuQ1) a) SJF(NP): AVG W.T-4.8

Baljit Singh Sainicorrect..solve others also

HarmanQ2) B

AWT = 3.25

K M RIDOY HASANQ2:ANSWER:

a) SJF(NP)

AWT=3.75

b)SJF(P)

AWT=3.25

Baljit Singh SainiGreat

K M RIDOY HASANQ1 ANSWER:

a) FCFS AWT=6.6

b)SJF(NP) AWT =4.8

c)SJF(P) AWT=5.2

Baljit Singh Saini(a) and (b) are correct. For (c) it should be 4.6. Check again

K M RIDOY HASANfor c …..i am not getting.Can you please explain

SakethQ2. b) SJF(P): Avg WT: 3.25

Himanshu KhanduriQ2

a) SJF(NP)

AWT=3.75

b)SJF(P)

AWT=3.25

HarmanQ3) 1

AWT = 4.25

Baljit Singh Sainiwrong.

Pranit PatilQ3

A — AWT = 4

B — AWt = 4.2

Baljit Singh SainiB:4.25

K M RIDOY HASANQ3:

A)(NP) AWT=4;

ATAT=7.75

B)(P) AWT=3.5

ATAT=7.25

Baljit Singh SainiA is correct. for B it should be 4.25(AV. Waiting) and 8 (TAT)

SakethQ3. a) Priority(NP) : Avg WT: 4

Baljit Singh Sainicorrect..calculate for other also

Sourabh3 que avg waiting 4.7 and avg turnaround time is 8.5

Baljit Singh SainiA) Av. Wait: 4 and TAT: 7.75

B) Av. Wait: 4.25 and TAT: 8

Himanshu KhanduriQ3:-

A)AWT(Np)=4;

ATAT=7.75

B) AWT(P)=3.5

ATAT=7.25

Baljit Singh SainiA) Av. Wait: 4 and TAT: 7.75

B) Av. Wait: 4.25 and TAT: 8