Hi suve ,
Here I am trying to give a small example, Hope this will help you some extent
/*Here is the Simplest program for schedulin policy is FCFS which is also known as
FIFO or a strict queing scheme. */
Code:#include <stdio.h> #include <Conio.h> int main () { int i = 0, k = 0, b = 0, x[10], c = 0, s[10], a [10], r =0; float t = 0.0; printf ("Enter the number of Processes"); scanf ("%d", &a[i]); for (i = 0; i<=r; i++) { printf ("Enter the process p %d", i); scanf ("%d", &a[i]); printf ("Enter the arrival time"); scanf ("%d", &x[i]); } for (i = 1; i<=r; i++) { c = c+ a[i]; s[i] = c; k = k + s[i] - x[i]; }t = (float) k /r; printf ("turn around time:%f\n", t); b = t - s[r]; t = (float) b / r; printf ("waiting time, %f\n", t); printf ("Response time,%f\n", t) ; getch (); return 0; }



LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks