hi alll
am a new member of this this amazing community and feel good to be part of it.i required help regarding simulation of multilevel feedback queue.i have checked many samples of scheduling but couldnt got right...so can any body help me?? code of this simulation should be in c/c++ ,java/java script...i would be really thankful.last date of project is 27-04-2005
waitin for your reply...really lookin forward to you guys!!!!!
falak

#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<string.h>
void mainmenu();

class queue
{
private:
 int timequan,prior;
public:
void rrobin();
void fcfs();
};
void queue :: rrobin()
{
 cout<<"Please Enter The Priority For This Queue"<<endl;
 cin>>prior;
 while(1)
 {
	if(prior==1&&prior==2)
	{
		timequan=2;
		cout<<"Time Quantum For This Queue is "<<timequan<<endl;
		break;
	}
	if(prior==3&&prior==4)
	{
		timequan=4;
		cout<<"Time Quantum For This Queue is "<<timequan<<endl;
		break;
	}
	else
	{
		cout<<"Please Enter Valid Priority Between 1-5 "<<endl;
		break;
	}

}
void queue :: fcfs()
{
    prior=5;
    cout<<"This Queue Has Fixed Priority"<<prior<<endl;
}

class process
{
 private:
	int pno,pbtime,pprior,parrival,pwait,ptat;
	char pid[10];
 public:

	queue(){pno=pbtime=pprior=parrival=pwait=ptat=pid[10]=0;}
	queue(int n,char id[],int btime,int prior,int arrival,int wait,int tat)
	{
	pno=n;
	pbtime=btime;
	parrival=arrival;
	pwait=wait;
	ptat=tat;
	pprior=prior;
	strcpy(pid,id);
	}
	void getdata();
	void showdata();

};
void process :: getdata()
{
	cout<<"\nPlease Enter No Of Processes  ";
	cin>>pno;
	cin.ignore(10,'\n');
	cout<<"\nPlease Enter Process Id  ";
	cin.get(pid,'10');
	cout<<"\nPlease Enter Process Priority  ";
	cin>>pprior;
	cout<<"\nPlease Enter Process Burst Time  ";
	cin>>pbtime;
	cout<<"\nPlease Enter Process Arrival Time  ";
	cin>>parrival;
}
void process :: showdata()
{
	cout<<"\nProcess No "<<pno<<endl;
	cout<<"\nProcess ID "<<pid<<endl;
	cout<<"\nProcess Priority "<<pprior<<endl;
	cout<<"\nProcess  Burst Time "<<pbtime<<endl;
	cout<<"\nProcess  Wait Time "<<pwait<<endl;
	cout<<"\nProcess  Arrival Time "<<parrival<<endl;
	cout<<"\nProcess  Turn Around Time "<<ptat<<endl;
}


void main()
{
	
	int total,i,choice;
	process p[i];
	textmode(3);

	while(1)
	{
		mainmenu();
		gotoxy(17,17);
		cout<<"Please Enter Your Choice ";
		cin>>choice;

		switch(choice)
		{
			case 1:
				clrscr();
				cout<<"Please Enter The Total Number Of Processes ";
				cin>>total;
				for (i=1;i<=total;i++)
				   p[i].getdata();
				getch();
				break;
			case 2:
				clrscr();
				for (i=1;i<=total;i++)
				   p[i].showdata();
				getch();
				break;
			
			case 3:
				exit(0);

			default:
				gotoxy(17,19);
				cout<<"Please Enter The Correct Choice";
				getch();
				continue;
		 }
}
getche();
}

	  void mainmenu()
		{
		    clrscr();
		    cout<<"    \n\n\t\t\tMain Menu"<<endl;
		    cout<<"\n\t\t1.Insert Process"<<endl;
		    cout<<"\n\t\t2.Display Processes"<<endl;
		    cout<<"\n\t\t3.Exit"<<endl;

		}

Code tags added. -Narue

i make a analysis and type this code in whole day...am really short of time as u know i have already 3 projects on pending, deadline of project is near to an end....
now its up to u to implement multilevel feedback queue

This article has been dead for over six months. Start a new discussion instead.