Results 1 to 2 of 2

Thread: First come First served algorithm in C

  1. #1
    Senior Member suve's Avatar
    Join Date
    Jun 2012

    First come First served algorithm in C

    Hi all,

    Can anyone in the forum please help me what is the First come first served algorithm, Please give a sample example which will help me more....


  2. #2
    Senior Member Bandhavi's Avatar
    Join Date
    May 2012
    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. */

    #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;

Similar Threads

  1. Example fo generic rotate algorithm
    By Yuvan in forum C, CPP Programs
    Replies: 0
    Last Post: 02-26-2013, 12:14 PM
  2. linear search algorithm in c
    By Bandhavi in forum C, CPP Programs
    Replies: 0
    Last Post: 10-15-2012, 12:28 PM
  3. Algorithm to Inset an element in the stack in C
    By suve in forum Programming languages
    Replies: 0
    Last Post: 07-25-2012, 08:16 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts