473,486 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

scheduling program

4 New Member
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 12177
sicarie
4,677 Recognized Expert Moderator Specialist
Well, aside of posting in the wrong forum, what do you have so far?
Feb 18 '08 #2
cyrine
4 New Member
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 Recognized Expert Moderator Contributor
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 New Member
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
2872
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
2315
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
2544
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
1473
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
578
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
2818
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
2358
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
26801
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
1812
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
1952
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
6964
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
7126
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
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4865
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.