Posts

Showing posts from March, 2016

Finding turnaround and waiting time of FCFS scheduling using a c program

#include<stdio.h> #include<conio.h> Turnaround time and waiting time when arrival time is not given: void main() { int p[10],i,w[20],t[10],b[10],n; clrscr(); printf("Enter the number of processes and their burst time"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("\np%d->>",i); scanf("%d",&b[i]); } t[1]=b[1]; w[1]=0; for(i=1;i<=n;i++) { t[i+1]=t[i]+b[i+1]; w[i+1]=t[i+1]; } printf("--------------------------------------------------------\n"); printf("process\t\tBurst time\tturnaround time\tWaiting time\n"); for(i=1;i<=n;i++) {       printf("\np%d->>\t\t",i); printf("%d\t\t%d\t\t%d\t\t",b[i],t[i],w[i]); } printf("\n--------------------------------------------------------"); getch(); } Turnaround time and waiting time when arrival time is given: #include<stdio.h> #include<conio.h>