Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve this java programming assignment Coding Assignment: In this problem you will develop code to simulate a dual-class queuing system with traffic loopback. The server

Solve thisĀ  java programming assignment

imageimageimage

Coding Assignment: In this problem you will develop code to simulate a dual-class queuing system with traffic loopback. The server you simualate accepts requests from two classes of users that send requests with different parameters. Moreover, once a request leaves the server, it might leave the system or go back and ask for more service. The additional amount of service time is distributed in the same was as the originally requested amount. After that, the request might go out or loop back in and so on. Request service times at all the servers are modeled using an exponential distribution, while the arrival process of all the requests follows a Poisson distribution (Hint: recall that if an arrival process is Poissonian, then the inter-arrival time between requests is exponentially distributed). a) Extend your Simulator class to be able to handle two independent streams of requests, of class X and Y, respectively. The Server should still be used to enqueue and process arriving requests following a given policy FIFO or Shortest Job Next (SJN). Once again, you are free to take any implementation choice that allows the simulator to correctly handle the simulated traffic and service policies. For this part, still assume that once a request has completed processing at the server, it leaves the system immediately. Like before, the simulator should have a method with the following prototype: void simulate (double time), that simulates the arrival and execution of requests at a generic server for time milliseconds, where time is passed as a parameter to the method. The class should be implemented in its own java file, named Simulator.java. The simulator class will internally use a exponentially-distributed random number generator, a timeline and two load generators. For these, you can re-use/adapt the classes you wrote as part of the previous assignment. Please be mindful of the capitalization in all the files you submit. Apart from implementing the simulate (...) method, the class should also include a main (...) function. The main (...) function should accept 6 parameters from the calling environment (in the following order): (a) length of simulation time in milliseconds. This should be passed directly as the time parameter to the simulate (...) function. (b) average arrival rate of requests of class X (^x); (c) average arrival rate of requests of class Y (^y); (d) average service time at the server for requests of class X (Tsx); (e) average service time at the server for requests of class Y (Tsy); (f) queuing policy which can either be "FIFO" or "SJN"; (g) probability Pout of leaving the system after completion (set to 1 for this part). It is responsibility of the main (...) function to internally invoke the implemented simulate (...) function only once. In this first version, the simulate (...) function will need to print in the console the simulated time at which each request of class X or Y arrives at the system (ARR), initiates service (START), and completes service (DONE). To generate a sequence of ARR events with the right inter-timing, reuse the loadGenerator approach from HW1. In this case, you will have two LoadGenerator instances, for class X and Y requests, respectively. When their releaseRequest(...) is called, TWO things happen: (1) just like before, generate the next arrival using or Ay; and (2) create a new Request object with length sampled from an exponential distribution with parameter 1/Ts, or 1/Tsy and pass it to the Server. Thus, the Server class should have some receiveRequest(...) method that can be called by the LoadGenerator for this purpose. At the end of the simulation, still print out global statistics for the utilization (UTIL), average system

Step by Step Solution

3.41 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

To tackle this coding assignment youll need to create a Java program with several classes Simulator Server LoadGenerator and Request These classes will interact to simulate the queuing system with tra... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Quantum Mechanics

Authors: David J. Griffiths, Darrell F. Schroeter

3rd Edition

1107189632, 9781107189638

More Books

Students also viewed these Programming questions