Solve this java programming assignment Coding Assignment: In this problem you will develop code to simulate a
Fantastic news! We've Found the answer you've been seeking!
Question:
Solve this java programming assignment
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
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... View the full answer
Related Book For
Introduction To Quantum Mechanics
ISBN: 9781107189638
3rd Edition
Authors: David J. Griffiths, Darrell F. Schroeter
Posted Date:
Students also viewed these programming questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Draw the BST that results when you insert the keys E A S Y QUE S T I O N in that order into an initially empty tree. What is the height of the resulting BST?
-
What meaning is given to the probability of an event by the frequentist interpretation of probability?
-
Graph the function. y = = + 2 X
-
Several professionals are listed as being part of compliance efforts with regard to participation in the examination of potential compliance violations. Identify at least three other categories of...
-
Revenue Recognition on Marina Sales with Discounts Taylor Marina has 300 available slips that rent for $800 per season. Payments must be made in full at the start of the boating season, April 1,...
-
In the estimation of international trade's casual effect on country's income, InYa+BT+yWi+i, = where Y; denotes income per person, T; denotes international trade, W; denotes within-country trade and...
-
The distance of the object to the mirror is 12 cm. The focal length of the mirror is 10 cm. How far is the image from the mirror? A. 22 cm B. 12 cm C. 60 cm D. 5 cm
-
An unlevered firm has a value of $650 million. An otherwise identical but levered firm has $125 million in debt. Under the MM zero-tax model, what is the value of the levered firm?
-
Consider a model of random interest rates R; between year i and i+1. The R, are i.i.d. random variables such that 1+ R; is LogNormal (0.03,0.0010) distributed. Suppose you deposit an amount of 4000...
-
Find the present value of an annuity due that pays $1,600.00 at the beginning of each quarter for 4 years, if interest is earned at a rate of 4%, compounded quarterly.
-
What factors contribute to the predominant distribution of rainforests primarily encircling the equatorial regions of the Earth?
-
An executive is to receive a $1,500,000 signing bonus today, $2,500,000 one year from now, $2,750,000 two years from now, and $3,200,000 three years from now. Assuming an annual discount rate of 12%...
-
Design a 3-bit flash ADC, what is the output digital word when the reference voltage is (8 volt) and the input analogue voltage is (5.5 volt)
-
a) Calculate the goodwill that was paid by Major Ltd on the acquisition of Minor Ltd. [10 marks] b) Prepare the consolidated statement of financial position for Major Ltd at 31 July 20X8. [30 marks]...
-
As an angular momentum, a particles spin must flip under time reversal (Problem 6.36). The action of time-reversal on a spinor (Section 4.4.1) is in fact so that, in addition to the complex...
-
Because the three-dimensional harmonic oscillator potential (see Equation 4.215) is spherically symmetrical, the Schrdinger equation can also be handled by separation of variables in spherical...
-
Verify Equations 4.175 and 4.176 using the ClebschGordan table. |11) = (10) = -1) = (I)+|)) <4T>} |) S= 1 (triplet). (4.175)
-
A circular shaft of radius \(r\) in the figure has a moment of inertia \(I\) and polar moment of inertia \(J\). The shaft is under torsion \(T_{z}\) in the positive zaxis and bending moment \(M_{x}\)...
-
A 20mm diameter rod made of a ductile material with a yield strength of \(350 \mathrm{MPa}\) is subject to a torque of \(T=100 \mathrm{~N} \cdot \mathrm{m}\) and a bending moment of \(M=150...
-
The figure below shows a round shaft of diameter \(1.5 \mathrm{in}\). loaded by a bending moment \(M_{z}\) \(=5,000 \mathrm{lb} \cdot\) in., a torque \(T=8,000 \mathrm{lb} . \cdot\) in., and an axial...
Study smarter with the SolutionInn App