954,174 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pls Kindly help me

I have a homework assignment that l started, but l ran into problems. Could you please look at my code and help me. The topic is as follow:

In this exercise, you will study the effect of several parameters used with RR scheduling. To solve the exercise, you will need to implement a discrete simulation to experiment with the performance of this strategy under different time slice lengths and different dispatcher overhead times. Do this by writing a simulation program to imitate the behavior of a single-CPU system that has a preemptive RR scheduler, and then collecting performance data regarding the operation of the simulation.

The Code is:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.Math;

public class Simulation
{
public static void main(String [] args) throws IOException
{
BufferedReader console = new BufferedReader(new
InputStreamReader(System.in));

System.out.print("\n The time quantum (for Round
Robin algorithm)\n");
System.out.print("Time Quantum: ");
String input = console.readLine();
int quantum = Integer.parseInt(input);
int [] timequantum = new int[quantum];
for (int i=0;i0;j--)
{
avg++; //counts up all burst times
turnAround[i] = avg; //stores it in the correct array index
}
b2[i]=0; //makes sure there are no minus values
}
}
Else
{
for(int j=q;j>0;j--)
{
avg++; //counts up all burst times
if(b2[i]!=0) //if process bursts are != 0 then they haven't finished
turnAround[i] = avg; //over-right old time
}
b2[i]=b2[i]-q; //takes time quantum away from burst times, if it goes
below 0 it gets reset to 0
}
}
}
for(int i=0;i

favorlove
Newbie Poster
8 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

Well whats the problem you're having? Don't just post your homework problems and say fix it, you'll never get anyone to help that way.

Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51
 

Thanks for replying.
My problem is that, have read the time quantum and the latency in while at the same time read in the start time and the burst times from a text file and then get the four of these figures to give me the average time waiting and the turnaround time. I m just totally lost on how to do this like i know how to calculate the times but after that im lost .

favorlove
Newbie Poster
8 posts since Mar 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You