Lab No 6 First Come First Serve (FCFS) Algorithm

Perhaps, First-Come-First-Served algorithm is the simplest scheduling algorithm. Processes are dispatched according to their arrival time on the ready queue. Being a non-preemptive discipline, once a process has a CPU, it runs to completion. The FCFS scheduling is fair in the formal sense or human sense of fairness but it is unfair in the sense that long jobs make short jobs wait and unimportant jobs make important jobs wait. FCFS is more predictable than most of other schemes since it offers time. FCFS scheme is not useful in scheduling interactive users because it cannot guarantee good response time. The code for FCFS scheduling is simple to write and understand. One of the major drawback of this scheme is that the average time is often quite long. The First-Come-First-Served algorithm is rarely used as a master scheme in modern operating systems but it is often embedded within other schemes. Direction: FCFS(first come first serve) in C++. #include using namespace std; int main() { int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j; cout<<"Enter total number of processes(maximum 20):"; cin>>n; cout<<"nEnter Process Burst Timen"; for(i=0;i>bt[i];} wt[0]=0; //waiting time for first process is 0 //calculating waiting time for(i=1;i

Comments

Popular posts from this blog

Magnifier- Magnifying Glass Privacy Policy

Boot Windows Oops, we get this horrible error! new method

Lab. No 8 Shortest Job First Operating System