Skip to main content

Posts

Featured

Round robin scheduling in C with arrival time

Round robin process scheduling algorithm in C with gantt chart. #include<stdio.h> struct p{     int no,bt,at,rbt,ct; }; int front=-1,rear=-1,n,pt=0,total=0; int q[30]; struct p process[25]; void add(int c) //Insert element c into the queue {   if(front==-1)     front=0;   q[++rear]=c; } int rem() //Remove element and return it from the queue {   if(rear<front)   {     front=rear=-1;     return -1;   }   else return q[front++]; } void insert(int pos,int c) //Insert element c into the queue at a given position {   int df,dr;   df=front;   dr=rear;   int i;   for(i=dr;i>=pos;i--)   {     q[i+1]=q[i];   }   q[pos]=c;   rear++; } void printq() //Print the queue {   int i;   if(front!=-1 && front<=rear)     for(i=front;i<=rear;i++)     {       printf("%d \t",q[i] );     }   else printf("Queue empty\n");   printf("\n" ); } void sort() //Sort the process according to their arrival time and place it in queue {   int i,j,temp;   for(i=0;

Latest posts

INTRODUCTION TO "RASPBERRY-Pi"

INSIGHT ON MIOS

What is Arduino?