title: First Come First Serve Multiprocessor (6 processors) scheduler in C code
body: <p>I am developing for a FCFS scheduler algorithm.  But it only works with one processor.  How can divide the task into 6 processors? I would need waiting queue, ready queue, etc.</p>
  
  <p>Each processor should work individually, if one processor finishes its task, then it would take the next task without waiting for all the processors to finish.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
  
      int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j;
      printf("Enter total number of processes(maximum 20):");
      scanf("%d",&amp;n);
  
      printf("\nEnter Process Burst Time\n");
      for(i=0;i&lt;n;i++)
      {
          printf("P[%d]:",i+1);
          scanf("%d",&amp;bt[i]);
      }
  
      wt[0]=0;    //waiting time for first process is 0
  
      //calculating waiting time
      for(i=1;i&lt;n;i++)
      {
          wt[i]=0;
          for(j=0;j&lt;i;j++)
              wt[i]+=bt[j];
      }
  
      printf("\nProcess\t\tBurst Time\tWaiting Time\tTurnaround Time");
  
      //calculating turnaround time
      for(i=0;i&lt;n;i++)
      {
          tat[i]=bt[i]+wt[i];
          avwt+=wt[i];
          avtat+=tat[i];
          printf("\nP[%d]\t\t%d\t\t%d\t\t%d",i+1,bt[i],wt[i],tat[i]);
      }
  
      avwt/=i;
      avtat/=i;
      printf("\n\nAverage Waiting Time:%d",avwt);
      printf("\nAverage Turnaround Time:%d",avtat);
  
      return 0;
  }
  </code></pre>