Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4 Coding Assignment: In this problem you will develop code to simulate a single queue of finite length K with multiple servers N. The

image text in transcribedimage text in transcribed

Problem 4 Coding Assignment: In this problem you will develop code to simulate a single queue of finite length K with multiple servers N. The time to process a request at any of the N servers is modeled using an exponential distribution, while the arrival process of the requests at the queue (there is only one queue shared by all N servers!) follows a Poisson distribution (Hint: recall that if an arrival process is Poissonian, then the inter-arrival time between requests is ezponentially distributed) a) For this first part, assume N-1. Write a Java class namely simulatorK.java that implements a discrete event simulator. The simulator should have a method with the following prototype: void simulate (double time), that simulates the arrival and execution of requests at the system for time milliseconds, where time is passed as a parameter to the method. The class should be implemented in its own java file, named simulatorK.java. The simulator class will internally use a exponentially- distributed random number generator. For this, you can re-use the function you wrote as part of the previous assignment Apart from implementing the simulate(...) method, the class should also include a public static void main(String [] args) function. The main(...) function should accept 4 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; (c) average service time at the servers; (d) K maximum length of the queue expressed in number of requests; 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 arrives at the system (ARR), initiates service (START), and completes service (DONE). when a new request arrives at the system while the current total number of requests in the system q K (system is full), then the newly arrived request is dropped and discarded (see DROP). The output must look like this: RO ARR: RO START: R1 ARR: R2 ARR: RO DONE: R1 START: R1 DONE: R2 START: R2 DONE: R3 ARR: R3 START: R4 ARR: R5 ARR: R6 DROP: UTIL: QLEN: Problem 4 continued on next page. Problem 4 Coding Assignment: In this problem you will develop code to simulate a single queue of finite length K with multiple servers N. The time to process a request at any of the N servers is modeled using an exponential distribution, while the arrival process of the requests at the queue (there is only one queue shared by all N servers!) follows a Poisson distribution (Hint: recall that if an arrival process is Poissonian, then the inter-arrival time between requests is ezponentially distributed) a) For this first part, assume N-1. Write a Java class namely simulatorK.java that implements a discrete event simulator. The simulator should have a method with the following prototype: void simulate (double time), that simulates the arrival and execution of requests at the system for time milliseconds, where time is passed as a parameter to the method. The class should be implemented in its own java file, named simulatorK.java. The simulator class will internally use a exponentially- distributed random number generator. For this, you can re-use the function you wrote as part of the previous assignment Apart from implementing the simulate(...) method, the class should also include a public static void main(String [] args) function. The main(...) function should accept 4 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; (c) average service time at the servers; (d) K maximum length of the queue expressed in number of requests; 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 arrives at the system (ARR), initiates service (START), and completes service (DONE). when a new request arrives at the system while the current total number of requests in the system q K (system is full), then the newly arrived request is dropped and discarded (see DROP). The output must look like this: RO ARR: RO START: R1 ARR: R2 ARR: RO DONE: R1 START: R1 DONE: R2 START: R2 DONE: R3 ARR: R3 START: R4 ARR: R5 ARR: R6 DROP: UTIL: QLEN: Problem 4 continued on next page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions