• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Having trouble  RSS feed

Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I am having trouble with an assignment I am doing for my class.
The Assignment is as follows:

Compare the performance of a 4-computer network in the following situations:

- First Come First Serve (the first computer to have a message available gets complete control of the network until transmission is done).

- The network uses Time Division Multiplexing with computers taking turns with one packet (10 Kb) being sent every time.

- The same as the situation before except that computers with nothing to send forfeit their turns.

Turn in a report (with a cover page) comparing the performance of the network in all 3 situations. Also turn in any code used to generate the report or create the simulation. Calculate the average wait time for all messages.


- In each of the three situations 100 random-sized messages need to be sent. The size will vary between 10 K and 15 MB (in increments of 10 K).

- The transfer rate is 96 K/ sec.

The part I am have trouble with is step two: - The network uses Time Division Multiplexing with computers taking turns with one packet (10 Kb) being sent every time.

I can not figure out how to divide it up sending 10Kb at a time, and then giving the total time to send all four messages. Anyone able to help me out?

This is the code I have so far:

import java.util.Random;

public class Trial
public Random RNG;
public float time;
public float transfer;

public Trial()
RNG = new Random();
transfer = 96000;

public void GenerateData()
for(int i = 1; i < 101; i++){
int GenerateComputer = RNG.nextInt(4);
long DataSize = RNG.nextInt(1536001);
System.out.println("-Computer " + (GenerateComputer + 1) + " sends " + (DataSize * 10) + " bits of data.");
time = ((DataSize * 10) / (transfer));
System.out.println("The total time to transfer the file took " + time + " seconds at 96k/sec.");

Posts: 64481
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are having difficulty with the algorithm to work out how to allocate network usage. I think you are going to have to try it first the hard way, with pencil and paper.
Work out how long each computer will take to send the message, or send 10kB worth, and how long the delays are, and get a formula. Then implement that formula.

Example: on the back of the Highway Code in Britain it shows how long "thinking distance" and "braking distance" are at different speeds, 20ft + 20ft = 40ft at 20mph, and 70ft + 245ft = 315ft at 70mph. It is doubled on wet roads and up to 10-fold on icy roads. For that you can work out a formula that stopping distance = speed + speed squared / 20. That comes out in Java asTry it. At 100mph on solid black-ice that gives a stopping distance of a mile, near as makes no difference!

You will have to work out such a formula. I presume this is a Java programming assignment, not a networking assignment? Then it won't matter if the formula is wrong, as long as you can kid whoever is marking that it looks correct.

Everybody's invited. Except this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!