473,386 Members | 1,743 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,386 software developers and data experts.

Assignment to create CPU scheduler.

we have this requirement in school that we have to create a program that will able to solve the cpu scheduling (first come first serve, 1st job done and we need it to gant chart it). please teach me how to create a simple chart...


it suppose to be like:


Process ____________________Burst time________________ Arrival time
A _________________________ 5_______________________1
B _________________________ 6 ______________________ 2
C _________________________10 _____________________ 3



and that chart should be like:


___________0___5___6_____10_______________________ ______
A ] ___//////
B ] _______//////
C ] ___________ //////////


the faded will skip the previous time and should only be in the current time,
like in C, 6-10...... and i need it in C++
Please Help Thanks



and one more thing, im using do while statement w/ switch on it



its like

Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3. int j1, j2, j3, time, arrival;
  4. char answer;
  5.  
  6.  
  7.             /* Third Screen - CPU SCHEDULING ! */
  8.  
  9. do
  10.     {
  11.  
  12. clrscr();
  13.  
  14. printf("\n\n\n                   Cpu Scheduling");
  15.  
  16. printf("\n\n                  First Come First Serve");
  17.  
  18. printf("\n\n\n\n\n           Enter the following 1st Burst time: ");
  19. s("%d", &j1);
  20.  
  21. clrscr();
  22.  
  23. printf("\n\n\n                   Cpu Scheduling");
  24.  
  25. printf("\n\n                  First Come First Serve");
  26.  
  27. printf("\n\n\n\n\n           Enter the following 2nd Burst time: ");
  28. s("%d", &j2);
  29.  
  30. clrscr();
  31.  
  32. printf("\n\n\n                   Cpu Scheduling");
  33.  
  34. printf("\n\n                  First Come First Serve");
  35.  
  36. printf("\n\n\n\n\n           Enter the following 3rd Burst time: ");
  37. s("%d", &j3);
  38.  
  39. clrscr();
  40.  
  41. printf("\n\n\n                   Cpu Scheduling");
  42.  
  43. printf("\n\n                  First Come First Serve");
  44.  
  45. printf("\n\n\n\n\n           Enter the following Arrival time: ");
  46. s("%d", &time);
  47.  
  48.  
  49.  
  50. printf("\n\n\n\n           Process        Burst Time         TimeArrival Time");
  51.  
  52. printf("\n\n             J01            %d                  %d ", j1,time);
  53.  
  54. printf("\n\n             J02            %d              %d ", j2,arrival=time+1);
  55.  
  56. printf("\n\n             J03            %d              %d ", j3,arrival=arrival+1);
  57.  
  58. p("\n\n\n\n\n\n        Response                    Gant Chart ");
  59.  
  60. p("\n\n\n        Do you want to try it again? [ Y / N ]: " );
  61. s("%c", &answer);
  62.  
  63. }
  64. while (answer == 'y' );
  65.  
  66.  
  67. getche();
  68. }

my prob are
1. i cant make it go back to DO when i enter y....
2. how can i make a chart
3. is it possible that it can accept small y and capital Y, how?
4. and how can i make not to accept other letters or special char rather than
y, Y, n and N...?


PLEASE HELP thanks
Aug 26 '07 #1
1 4170
gpraghuram
1,275 Expert 1GB
we have this requirement in school that we have to create a program that will able to solve the cpu scheduling (first come first serve, 1st job done and we need it to gant chart it). please teach me how to create a simple chart...


it suppose to be like:


Process ____________________Burst time________________ Arrival time
A _________________________ 5_______________________1
B _________________________ 6 ______________________ 2
C _________________________10 _____________________ 3



and that chart should be like:


___________0___5___6_____10_______________________ ______
A ] ___//////
B ] _______//////
C ] ___________ //////////


the faded will skip the previous time and should only be in the current time,
like in C, 6-10...... and i need it in C++
Please Help Thanks



and one more thing, im using do while statement w/ switch on it



its like

int main()
{
int j1, j2, j3, time, arrival;
char answer;


/* Third Screen - CPU SCHEDULING ! */

do
{

clrscr();

printf("\n\n\n Cpu Scheduling");

printf("\n\n First Come First Serve");

printf("\n\n\n\n\n Enter the following 1st Burst time: ");
s("%d", &j1);

clrscr();

printf("\n\n\n Cpu Scheduling");

printf("\n\n First Come First Serve");

printf("\n\n\n\n\n Enter the following 2nd Burst time: ");
s("%d", &j2);

clrscr();

printf("\n\n\n Cpu Scheduling");

printf("\n\n First Come First Serve");

printf("\n\n\n\n\n Enter the following 3rd Burst time: ");
s("%d", &j3);

clrscr();

printf("\n\n\n Cpu Scheduling");

printf("\n\n First Come First Serve");

printf("\n\n\n\n\n Enter the following Arrival time: ");
s("%d", &time);



printf("\n\n\n\n Process Burst Time TimeArrival Time");

printf("\n\n J01 %d %d ", j1,time);

printf("\n\n J02 %d %d ", j2,arrival=time+1);

printf("\n\n J03 %d %d ", j3,arrival=arrival+1);

p("\n\n\n\n\n\n Response Gant Chart ");

p("\n\n\n Do you want to try it again? [ Y / N ]: " );
s("%c", &answer);

}
while (answer == 'y' );


getche();
}


my prob are
1. i cant make it go back to DO when i enter y....
2. how can i make a chart
3. is it possible that it can accept small y and capital Y, how?
4. and how can i make not to accept other letters or special char rather than
y, Y, n and N...?


PLEASE HELP thanks

1. i cant make it go back to DO when i enter y....
-->Put the do while loop ina while(1) loop and it is a infinite loop
2. how can i make a chart
-->I dont have idea about this
3. is it possible that it can accept small y and capital Y, how?
-->After getting the character convert it to an upper case character always and then check for 'Y' whichsolves the issue of checking for different combination.
4. and how can i make not to accept other letters or special char rather than
y, Y, n and N...?
-->You shuld have a logic in place for this and currently i am not getting an idea

Raghuram
Aug 27 '07 #2

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

Similar topics

7
by: Oliver Gräser | last post by:
Hej, I want to run batchfiles via the Shell, but accessible in the Browser via IIS. Actually, I'd like the server to start a command line ntbackup if a users selects to do so on an ASP in his...
4
by: keepyourstupidspam | last post by:
Anyone know of a reliable design for a Windows C++ Task Scheduler Class. The scheduler will expose a member function that will add schedules, its parameters will be an interval to run the tasks...
3
by: Pat | last post by:
A97, WinXP Hello, I am looking for a way to create a task (in the windows task scheduler) from an Access MDB using VBA. I found this great DLL: ...
1
by: Mike Thomas | last post by:
I want to start this thread again - on my first attempt I was a little ambiguous and was not able to get the answer I need. I am trying to start Access 2000 on Windows NT 2000 Server by using the...
4
by: LongBow | last post by:
Hello all, I have been working on my first embedded project which has been exciting and stressfull at the same time. My task now is to develop a good scheduler for transmitting ARINC labels....
8
by: VMI | last post by:
I'm searching for a way to build a scheduler that will store its data in sql server. I've searched google but it mostly displays sites that sell scheduler controls. Anyone know of any sites that...
4
by: Sid Price | last post by:
Is there a .NET (2003) class available somewhere that might provide a comprehensive task scheduler with a better granularity than the one minute of the built-in scheduler on XP? Even down to 15...
1
by: =?Utf-8?B?YXVzdGlyb2I=?= | last post by:
Hi, While I realise that this may not be a very nice solution architecturally, I kick off a Scheduler in an ASP.NET 2.0 webservice in Application_Start() which is supposed to call a stored proc...
4
by: John Dann | last post by:
I need what I'd call (in .Net) a timer, ie I need to run a function eg every 2 seconds - it doesn't need to be millisec accurate but it would be nice if it wasn't eg every 4 seconds or something. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.