473,387 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

scheduling program

4
im looking for a codes of scheduling w/c is shortest job first(non preEmptive) in operating system using a c++ language..
Feb 18 '08 #1
4 12175
sicarie
4,677 Expert Mod 4TB
Well, aside of posting in the wrong forum, what do you have so far?
Feb 18 '08 #2
cyrine
4
Well, aside of posting in the wrong forum, what do you have so far?

a code using visual basic.. first come first serve
i want to translate this into turbo C++ but shortest job first NP
Feb 19 '08 #3
Meetee
931 Expert Mod 512MB
a code using visual basic.. first come first serve
i want to translate this into turbo C++ but shortest job first NP
Yes, agree! But you need to read posting guidelines. We do not provide direct code in this community. Scheduling algorithm's algorithms are easily available by searching google. You can apply logic accordingly. Kindly narrate your problem here if you find any.

Regards
Feb 19 '08 #4
cyrine
4
Yes, agree! But you need to read posting guidelines. We do not provide direct code in this community. Scheduling algorithm's algorithms are easily available by searching google. You can apply logic accordingly. Kindly narrate your problem here if you find any.

Regards

pls help me to translate this into a visual basic language..

// PROGRAM FOR SJF - NON PREEMPTIVE SCHE
// DULING ALGORITHM
//PREPROCESSOR DIRECTIVES
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream.h>
//GLOBAL VARIABLES - DECLARATION
int Twt,Ttt,A[20],Wt[20],n,Bu[20];
float Att,Awt;
char pname[20][20];
//FUNCTION DECLARATIONS
void Getdata();
void Gantt_chart();
void Sjf();
//GETTING THE NUMBER OF PROCESSES AND TH
// E BURST TIME AND ARRIVAL TIME FOR EACH P
// ROCESS
void Getdata()


{
int i;
cout<<"\n Enter the number of processes: ";
cin>>n;
for(i=1;i<=n;i++)


{
fflush(stdin);
cout<<"\n\n Enter the process name: ";
cin>>pname[i];
cout<<"\n Enter The BurstTime for Process: "<<pname[i]<<endl;
cin>>Bu[i];
cout<<"\n Enter the Arrival Time for Process: "<<pname[i]<<endl;
cin>>A[i];
}
}

//DISPLAYING THE GANTT CHART
void Gantt_chart()


{
int i;
cout<<"\n\nGANTT CHART";
cout<<"\n--------------------------------------------------------------------\n"<<endl;
for(i=1;i<=n;i++)
cout<<pname[i];
cout<<"|\t\n";
cout<<"\n-----------------------------------------------------------\n";
cout<<"\n"<<endl;
for(i=1;i<=n;i++)
cout<<Wt[i]<<endl;
cout<<Wt[n]+Bu[n]<<endl;
cout<<"\n--------------------------------------------------------------------\n";
cout<<"\n";
}

//Shortest job First Algorithm with NonPreemption
void Sjf()


{
int w,t,i,B[10],Tt=0,temp,j;
char S[10],c[20][20];
int temp1;
cout<<"\n\n SHORTEST JOB FIRST SCHEDULING ALGORITHM \n\n"<<endl;
Twt=Ttt=0;
w=0;
for(i=1;i<=n;i++)


{
B[i]=Bu[i];
S[i]='T';
Tt=Tt+B[i];
}
for(i=1;i<=n;i++)


{
for(j=3;j<=n;j++)


{
if(B[j-1]>B[j])


{
temp=B[j-1];
temp1=A[j-1];
B[j-1]=B[j];
A[j-1]=A[j];
B[j]=temp;
A[j]=temp1;
strcpy(c[j-1],pname[j-1]);
strcpy(pname[j-1],pname[j]);
strcpy(pname[j],c[j-1]);
}
}
}
//For the 1st process
Wt[1]=0;
w=w+B[1];
t=w;
S[1]='F';
while(w<Tt)


{
i=2;
while(i<=n)


{
if(S[i]=='T'&&A[i]<=t)


{
Wt[i]=w;
S[i]='F';
w=w+B[i];
t=w;
i=2;
}
else
i++;
}
}
//CALCULATING AVERAGE WAITING TIME AND AVERAGE TURN AROUND TIME
for(i=1;i<=n;i++)


{
Twt=Twt+(Wt[i]-A[i]);
Ttt=Ttt+((Wt[i]+Bu[i])-A[i]);
}
Att=(float)Ttt/n;
Awt=(float)Twt/n;
cout<<"\n\n Average Turn around time=%3.2f ms "<<Att;
cout<<"\n\n AverageWaiting Time=%3.2f ms"<<Awt;
Gantt_chart();
}

void main()


{
clrscr();
Getdata();
Sjf();
getch();
}
Feb 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gilles Leblanc | last post by:
Hi I have started a small project with PyOpenGL. I am wondering what are the options for a GUI. So far I checked PyUI but it has some problems with 3d rendering outside the Windows platform. I...
6
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something...
0
by: steve | last post by:
I've seen questions about scheduling ASP scripts posted in this group many times so hopefully this will be useful information to a few people. I just wanted to let you all know that our script...
1
by: Newbie | last post by:
Could somebody please tell me whether it is possible to create a custom .NET application capable of scheduling Crystal Reports to execute at a certain point in time? I have a book explaining how...
3
by: Alphonse Giambrone | last post by:
Can anyone point me toward a good example of an asp.net scheduling app? Preferrably in vb.net. TIA -- Alphonse Giambrone Email: a-giam at customdatasolutions dot us
4
by: Dinsdale | last post by:
I'm looking at adding scheduling features to an application and I wanted to ask the community about any experience with scheduling components, either open source like from code project or from a...
2
by: kmdo | last post by:
Hi everybody... well i'm writing a very interesting program, but i need help making an scheduling module and not sure where to start...so please some body help me!!!
2
Ritchie
by: Ritchie | last post by:
Please can anyone help me with d programs in C for CPU scheduling: WAP to show FCFS scheduling algorithm. WAP to show SJF scheduling algorithm. WAP to show Priority scheduling algorithm. WAP...
1
by: amundsen | last post by:
I need to build a scheduling program. It will need to schedule a chain of resources. I'm wondering if anyone is aware of an existing framework that might help me to code this application. The...
4
by: IanWright | last post by:
I'm just wondering if anyone could give me any starters here.... I have a need to create a simple scheduling application, that will choose from a pool of avaliable people and assign them to a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.