SCHEDULING ALGORITHMSAIM OF THE EXPERIMENT:-
To study and implement scheduling algorithms (FCFS, SJF, Round Robin andPriority)
FIRST COME FIRST SERVED(FCFS):-
The process that requested the CPU first is allocated the CPU first.
FCFS policy is easily implemented with a FIFO queue.
When a process enters into the ready queue, its PCB is linked onto the tail of thequeue.
The average waiting time under the FCFS policy is often quite long.
The FCFS scheduling algorithm is NON-PREEMPTIVE.
Once the CPU has been allocated to a process, that process keep the CPU until itreleases the CPU, either by terminating or requesting I/O.
The FCFS algorithm is particularly troublesome for time sharing systems.
There is a convoy affect as all the other process wait for one big process to get off the CPU.
EXAMPLE:-PROCESS BURST TIME
P1 24P2 03P3 03
P1 P2 P30 24 27 30
PROCESS WAITING TIME TURN AROUND TIME
P1 00 24P2 24 27P3 27 30Avg. waiting time =(0+24+27)/3=17 time unit.Avg.turn around time =(24+27+30)/3=27 time unit.
SHORTEST JOB FIRST SHEDULING ALGORITHM (SJF):-
When CPU is available it is assigned to the process that has the smallest nextCPU burst.
FCFS scheduling is used to break tie.