Posts

Showing posts from September, 2018

Round Robin implementation in C

Image
Simulate the following RR CPU scheduling algorithms to find turnaround time and waiting time Round Robin is a  CPU scheduling algorithm  where each process is assigned a fixed time slot or quanta in a cyclic way. Things to remember RR is always used in preemptive way Commonly used in CPU its simple and starvation free since every process is given a fair share of time has a Overhead context switch problem   Program Output

SJF (non-preemptive) implementaion in C

Image
Simulating SJF non-preemptive CPU scheduling algorithms to find turnaround time and waiting time We are given with n processed with there arrival time and burst time, task is to find average waiting time and average turn around time. This algorithm is similar to that of the FCFC  but we need to sort the processes to obtain minimum waiting time or based on burst time while executing a process Things to remember SJF results in minimum waiting time since all processes are sorted based on burst time Chance of Starvation (A process may be keep on postponed can be solved by using Aging) Impractical to be used in an Operating System since the burst time cant be predicted Program Output

FCFS implementation in C

Image
Simulation of FCFS CPU scheduling algorithms to find turnaround time and waiting time We are given with n processed with there arrival time and burst time, task is to find average waiting time and average turn around time. Algorithm is simple as waiting in lines for our order in a burger shop where the first person is served first from where we get the FCFS as First Come First Serve also known as First in First out. Things to remember FCFS is a non-pre-emptive scheduling  Avg waiting time is not optimum compared to other scheduling Has Convay effect  Program Output