• Post Reply Bookmark Topic Watch Topic
  • New Topic

Round Robin Scheduling simulation  RSS feed

 
Vineet Kakati
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello people

I have to develop a code which simulates the round robin scheduling algorithm.
I have come up with the following code but am unable to figure out why the code fails.
please help

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"divine spirit", welcome to JavaRanch. Please check your private messages for an important administrative message.

And thanks for using code tags.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vineet Kakati wrote:... why the code fails.

What does that mean - does the code compile? If not, then what exactly is the error message? If it does compile, then what happens when you try to run it? How does the output differ from what you expected?
 
Vineet Kakati
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ jesper

The code does compile properly.I m trying to print the waiting time for each entered process.
The output I get is not desired output i.e waiting time displayed for each process is not as it will be for RR algo.
Waiting time is random no...
I have written the while loop specially for RR algo so I suspect the error must be in it.
please help....


Vineet
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's very hard to understand your question. You say "It doesn't compile correctly", but then talk about what it's printing.

Code either compiles or it doesn't. So let's start there. When you compile it with the "javac process.java", do you get errors, or does it work?

If it give you errors, please post those EXACT errors in their entirety.

If it DOES compile, then you have runtime errors. Please tell us exactly what it give you, and what you expect. Please DON'T use abbreviations...

I have no idea what "RR algo" means.

is "Waiting time is random no..." a statement ala "waiting time is a random number", or a question ala "Waiting time is random, no?".

 
Vineet Kakati
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I said the code does compile properly.
I get NO compilation errors.

My error is that the waiting time displayed for each process is not what it should be for roundRobin algo.
 
Larry Frissell
Ranch Hand
Posts: 82
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the problem appears to be in the logic used to determine the waiting time, try inserting print statements within the calculations and compare with what you expect. For example:


This will help you to isolate any math or logic errors.
 
Jonas Isberg
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the purpose of the variable j (small J)?
If you TellTheDetails it might be easier for us to help you.
 
Vineet Kakati
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it.
I used the method suggested by Larry.
Thank you..I was indeed able to isolate the errors.

regards
Vineet
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vineet Kakati wrote:I said the code does compile properly.


My apologies for mis-reading it.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!