473,609 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
+ 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 12188
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<iostre am.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\nGANT T CHART";
cout<<"\n--------------------------------------------------------------------\n"<<endl;
for(i=1;i<=n;i+ +)
cout<<pname[i];
cout<<"|\t\n";
cout<<"\n-----------------------------------------------------------\n";
cout<<"\n"<<end l;
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
2883
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 know of WxPython but I don't know if I can create a WxPython window, use gl rendering code in it and then put widgets on top of that...
6
2320
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 more sophisticated), and what situations might perturb it. Even a hint as to what would be considered normal scheduling might help. The root of our problem is that we observed a normally well-behaved web application suddenly limit itself to a...
0
2554
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 scheduling service at www.cronservice.co.uk has been rewritten from the ground up and is now better than ever. If you are looking for a way to schedule your ASP scripts and don't have access to cron or task scheduler then you need this service.
1
1491
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 to program a .NET application to designate Crystal Reports's output destinations and formattings. But, I do not know how to implement a "scheduling capability" for Crystal Reports onto a .NET application. I am aware that Crystal Reports has the...
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
2835
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 vendor. I'd like to be able to create schedules and lock resources for things like collision detection (two events trying to use the same resource). I've seen some GANTT charting components but I don't think that's what I'm looking for. I'd...
2
2362
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
26811
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 to show Round-Robin scheduling algorithm. disk scheduling:
1
1823
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 application I will be building will use C# and have a WinForms front end. The application I need to build is used to schedule multiple resources for an office. The office performs product testing. When a test subject comes in they will follow one...
4
1963
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 particular day of the month to carry out a certain task along with various assistants. Basically it's generating a rota for activities once a week which require a number of people (leaders and assistants). There are also a few requirements, people...
0
8127
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8067
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8567
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8527
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8215
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8398
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6053
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4015
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1380
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.