Assignment1_OS
Assignment1_OS
Sumbitted To:
Gaurav Kumar Pandey
(Faculty, CSE)
Submitted by:
Rishabh Anand MCA/10007/19
Ans:
The processes are assumed to have arrived in the order P1, P2,P3,P4,P5 all at
time 0.
GANTT CHART
First Come, First serve:
____________________________________
| P1| P2| P3 |P4 | P5| FCFS
|____|___|______|___|_______|
0 1 2 4 5 10
___________________________________________
|P2| P1 | P5 | P3 | P4| Priority21
|__|____|__________|_______|___|
0 1 2 7 9 10
Round Robin:
Quantum, given =1
_________________________________
|P1| P2| P3| P4| P5| P3| P5|RR
|__|___|___|___|___|___|___|
0 1 2 3 4 5 6 10
Turn around time for each process for every scheduling algorithm is:
Turn Around time= Finish Time-Arrival Time
2. What is starvation? Which scheduling does not suffer from starvation explain
with an example.
Ans:
It will occur:
a. If Priority scheduling is done, where all the processes are given higher priority
every time, but there is one process which is given low priority and it stays in
waiting period and is never executed.
The solution to the starvation problem is to assign a counter to each such low priority
task so that if these are delayed execution by cpu scheduler, they increment their
counter value and after a particular counter value these task gain more priority than any
other process and hence execution becomes inevitable, this technique is called Aging.
Example of starvation:
Consider a busy round-about in a big city where traffic from one side is always more
than other three sides. The traffic inspector opened the busy side and decided to wait
until the vehicles stop coming from that side before he opens the other side. This is the
condition of starvation as the vehicles will not stop coming from the busiest side and
meanwhile, all the other sides will be waiting for the signal to open.
First come first serve scheduling methods may also suffer starvation if processes having
long execution time arrives first and the rest of the coming processes have to wait until
first process terminates or leave CPU due to some interrupt.