added operating system algorithm's in c

pull/1010/head
aayushdadhich0409 2022-10-10 21:48:01 +05:30 committed by GitHub
parent 04d42af7c0
commit 9321a80f86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#include<stdio.h>
int main(){
int a,b,wt[10],bt[10],tat[10],n=4,i,j;
for(i=0;i<=n;i++){
printf("enter bt :%d\n",i);
scanf("%d",&bt[i]);
}
wt[0]=0;
tat[0] = wt[0]+bt[0];
for(i=1;i<=n;i++){
wt[i]=tat[i-1];
tat[i]=bt[i]+wt[i];
}
printf("\nprocess\t\t burst time\t\t waiting time\t\t turn around time\n");
for(j=0;j<=n;j++){
printf("%d\t\t %d\t\t %d\t\t %d\t\t \n",j+1,bt[j],wt[j],tat[j]);
// printf("%d\t\t %d\t\t %d\t\t %d\t\t \n",j+1,bt[1],wt[1],tat[1]);
// printf("%d\t\t %d\t\t %d\t\t %d\t\t \n",j+1,bt[2],wt[2],tat[2]);
// printf("%d\t\t %d\t\t %d\t\t %d\t\t \n",j+1,bt[3],wt[3],tat[3]);
}
return 0;
}

View File

@ -0,0 +1,27 @@
# operating system algo's
In this operating system folder, we can see the different tupes of scheduling algorithms used by CPU.
1. FCFS (first come first serve alogrithm)
-
First come first serve (FCFS) scheduling algorithm simply schedules the jobs according to their arrival time. The job which comes first in the ready queue will get the CPU first. The lesser the arrival time of the job, the sooner will the job get the CPU. FCFS scheduling may cause the problem of starvation if the burst time of the first process is the longest among all the jobs.
## Demo- output of FCFS_scheduling :
![App Screenshot](https://media.geeksforgeeks.org/wp-content/uploads/20200910234944/FCFS.jpg)
## Documentation
To know more about FCFS,[click here](https://www.geeksforgeeks.org/program-for-fcfs-cpu-scheduling-set-1/)
## Support
For support, email aayushdadhich0409@gmail.com.