Skip to main content

Posts

Showing posts with the label Scheduling Algorithm

Round Robin (RR) process scheduling algorithm in C Programming

#include #include void main() { int njob,pID[15],aTime[15],bTime[15],jTime[15],taTime[15],wTime[15],i,j,temp,sTime[15],aBtime[15]; int texe=0,qtime,aexe=0; float totalWait,totalTA; clrscr(); printf("\n Enter number of process:"); scanf("%d",&njob); printf("\n Enter quantum time:"); scanf("%d",&qtime); for(i=0;i =qtime) { aexe=aexe+qtime; bTime[i]=bTime[i]-qtime; jTime[i]=aexe; } else { if(bTime[i]!=0) { aexe=aexe+bTime[i]; bTime[i]=0; jTime[i]=aexe; } } } } for(i=0;i OUTPUT Enter number of process:3 Enter quantum time:4 Enter Burst time for process[0]:24 Enter Burst time for process[1]:3 Enter Burst time for process[2]:3 _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_ | process | burst time | Waiting time | TA time| _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_ | 0 | 24 | 6 30...

Priority process scheduling algorithm in C Programming

#include #include void main() { int njob,pID[15],aTime[15],bTime[15],jcTime[15],taTime[15],wTime[15],i,j,temp,sTime[15],prior[15]; float totalWait,totalTA; clrscr(); printf("\n Enter number of process:"); scanf("%d",&njob); for(i=0;i prior[j]) { temp=pID[i]; pID[i]=pID[j]; pID[j]=temp; temp=aTime[i]; aTime[i]=aTime[j]; aTime[j]=temp; temp=bTime[i]; bTime[i]=bTime[j]; bTime[j]=temp; temp=prior[i]; prior[i]=prior[j]; prior[j]=temp; } } } for(i=0;i OUTPUT Enter number of process:5 Enter the Arrival time , Burst time and Priority for process[1]:0 10 3 Enter the Arrival time , Burst time and Priority for process[2]:0 6 5 Enter the Arrival time , Burst time and Priority for process[3]:0 2 2 Enter the Arrival time , Burst time and Priority for process[4]:0 4 1 Enter the Arrival time , Burst time and Priority for process[5]:0 8 4 Process ArrivalTime BurstTime Priority Turnarou...

Shortest Job First (SJF) process scheduling algorithm in C Programming

#include #include void main() { int njob,pID[15],aTime[15],bTime[15],jcTime[15],taTime[15],wTime[15],i,j,temp,sTime[15]; float totalWait,totalTA; clrscr(); printf("\n Enter number of process:"); scanf("%d",&njob); for(i=0;i bTime[j]) { temp=pID[i]; pID[i]=pID[j]; pID[j]=temp; temp=aTime[i]; aTime[i]=aTime[j]; aTime[j]=temp; temp=bTime[i]; bTime[i]=bTime[j]; bTime[j]=temp; } } } for(i=0;i OUTPUT Enter number of process:5 Enter the Arrival time & Burst time for process[1]:0 9 Enter the Arrival time & Burst time for process[2]:1 5 Enter the Arrival time & Burst time for process[3]:2 2 Enter the Arrival time & Burst time for process[4]:3 6 Enter the Arrival time & Burst time for process[5]:4 8 Process ArrivalTime BurstTime TurnaroundTime WaitingTime _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ 3 2 2 2 ...

First Come First Serve (FCFS) process scheduling algorithm in C Programming

#include #include int fsize; int frm[15]; void display(); void main() { int pg[100],nPage,i,j,pf=0,top=-1,temp,flag=0; clrscr(); printf("\n Enter frame size:"); scanf("%d",&fsize); printf("\n Enter number of pages:"); scanf("%d",&nPage); for(i=0;i OUTPUT Enter the number of processes:5 Enter the Arrival Time & Burst Time for process[1]:0 9 Enter the Arrival Time & Burst Time for process[2]:1 5 Enter the Arrival Time & Burst Time for process[3]:2 2 Enter the Arrival Time & Burst Time for process[4]:3 6 Enter the Arrival Time & Burst Time for process[5]:4 8 PId ArrivalTime BurstTime JCTime WaitingTime TAtime _+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+ 1 0 9 9 0 9 2 1 5 14 8 13 3 2 2 16 12 14 4 3 6 22 ...