Program of FCFS - First come First out in c++
About FCFS
Operating System Design. The first come, first served (commonly called FIFO ‒ first in, first out) process scheduling algorithm is the simplest process scheduling algorithm. It is rarely used in modern operating systems, but is sometimes used inside of other scheduling systems.
Perhaps, First-Come-First-Served algorithm is the simplest scheduling algorithm is the simplest scheduling algorithm. Processes are dispatched according to their arrival time on the ready queue. Being a nonpreemptive discipline, once a process has a CPU, it runs to completion
Download C++ software Link || Dev C++ click On the Link Below.
Link: http://linkshrink.net/7Cd8Z1
Dev c++ : for coding in C/C++
Download C++ software Link || Dev C++ click On the Link Below.
Link: http://linkshrink.net/7Cd8Z1
Dev c++ : for coding in C/C++
Source Code of FCFS
- #include<iostream>
- 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 Time\n";
- for(i=0;i<n;i++)
- {
- cout<<"P["<<i+1<<"]:";
- cin>>bt[i];
- }
- wt[0]=0; //waiting time for first process is 0
- //calculating waiting time
- for(i=1;i<n;i++)
- {
- wt[i]=0;
- for(j=0;j<i;j++)
- wt[i]+=bt[j];
- }
- cout<<"\nProcess\t\tBurst Time\tWaiting Time\tTurnaround Time";
- //calculating turnaround time
- for(i=0;i<n;i++)
- {
- tat[i]=bt[i]+wt[i];
- avwt+=wt[i];
- avtat+=tat[i];
- cout<<"\nP["<<i+1<<"]"<<"\t\t"<<bt[i]<<"\t\t"<<wt[i]<<"\t\t"<<tat[i];
- }
- avwt/=i;
- avtat/=i;
- cout<<"\n\nAverage Waiting Time:"<<avwt;
- cout<<"\nAverage Turnaround Time:"<<avtat;
- return 0;
- }
ALSO Watch Video for Demo
I Hope you like Our Video..
dotclu
dot clu
=====Also Watch Our Video========
SJF-Shortest Job First or SJN (shortest job Next) || C++ program of SJF with input | dot clu
https://youtu.be/zXA3oS5p1UM
Get started With C || First Program in C || C tutorial || Hello world program in C || dot clu
link: https://youtu.be/Oqyoe1nJNjE
Install Virtual BOX in your PC | create Virtual Machine | downloading link in description || dot clu
link:https://youtu.be/x9ijUzOUyiY
How to Install Hyper V in windows 7?
link: https://youtu.be/Y64Dr3YNCSw
What is Bitcoin? || Earn Bitcoin money with your Android phone || 100% working || dot clu || Hindi
link: https://youtu.be/HYQgDQrSC1I
dotclu
dot clu
=====Also Watch Our Video========
SJF-Shortest Job First or SJN (shortest job Next) || C++ program of SJF with input | dot clu
https://youtu.be/zXA3oS5p1UM
Get started With C || First Program in C || C tutorial || Hello world program in C || dot clu
link: https://youtu.be/Oqyoe1nJNjE
Install Virtual BOX in your PC | create Virtual Machine | downloading link in description || dot clu
link:https://youtu.be/x9ijUzOUyiY
How to Install Hyper V in windows 7?
link: https://youtu.be/Y64Dr3YNCSw
What is Bitcoin? || Earn Bitcoin money with your Android phone || 100% working || dot clu || Hindi
link: https://youtu.be/HYQgDQrSC1I
Comments
Post a Comment