Professional Documents
Culture Documents
(A) FCFS:: Solution: T .A.T Copletion Time-Arrival Time
(A) FCFS:: Solution: T .A.T Copletion Time-Arrival Time
(A) FCFS:: Solution: T .A.T Copletion Time-Arrival Time
Consider the following scenario, there are five processes with burst time
Process Burst Time (ms) Priority
P1 1 1
P2 1 1
P3 2 4
P4 1 5
P5 5 2
The processes are assumed to have arrived in order P1, P2, P3, P4, P5 all at
time 0.find the turnaround time of each process for each of the following scheduling algorithms FCFS,
SJF, a non-pre-emptive priority (a smaller priority implies a higher priority) and RR (quantum=1)
scheduling. also, draw the Gantt chart. (5)
(a)FCFS: Since the arrival time of p1,p2,p,..p5 is 0 and it is mentioned in question they come in the order
Gantt chart:
P1 P2 P3 P4 P5
0 1 2
4 5 10
ANSWER:
(b)SJF: shortest job first is basically non pre-emptive ,since nothing is mentiond about preemption or non
1
Gantt chart:
P1 P2 P4 P3 P5
0 1 2 3 5 10
Answer:
Process then after completion of execution current process ,processor is allocated to next process
Gantt chart:
P1 P2 P5 P3 P4
0 1 2 7 9 10
Answer:
2
ROUND –ROBIN:
Gantt chart:
P1 P2 P3 P4 P5 P3 P5 0
1 2 3
4 5 6 10
ANSWER:
Answer : Starvation is a type of situation in which process under goes indefinitely in waiting state
For resources and never get resource to complete its execution.. starvation can occur in SJF ,SRTF,
FCFS,PRIORITY scheduling ,
Starvation in SJF & SRTF : this scheduling algorithm can cause starvation to some process p, if just before
currently running process completes its burst time another process always arrive with burst time
smaller then p
Starvation in FCFS : smaller FCFS does not gurantees that starvation will not occur if any pocess arrive
Infinite burst time then this process starve all the process in ready queue.
Starvation in priority : in this scheduling there is more possibilty of starvation can occur ,if any process
P is have less priority and the all arriving process high priority then process p will go on starvation.
Fixed time quantum to each process for execution and by context switching after every time quantum.
Let us consider given p1,p2,p3,p4…..p infinte process and each process require burst time (random no ) 1 ,5 ,6,9.
…… upto infinite.
If we use FCFS then process that comes in last has to wait until (last-1) process complete their execution, In case
3
of shortest job first a process which have highest burst time have to wait until all process complete their burst time ,
Round robin maintain a circular ready queue in all process that are raeady for execution are kept and this
Process are allowed to use cpu for some fixed time (time quantum) after that cpu is allocated to next process . every
Process after completing their burst time further enqueued into circular ready queue
Irrespective of process arrival time ,burst time and priority cpu is allocated to each process for fixed burst time.
If process p arrives at ready queue an it is at nth position then p has to wait for only .(n-1)*(time quantum)
Which always less then wait time of process in fcfs and srtf .