COMP9334 Revision Questions for Week 4B
Question 1
The Python function sim mm1 func() (in the file sim mm1 lib.py) simulates an M/M/1 queue with arrival rate ¦Ë and service rate ¦Ì over a time period of T . It returns the average response time for the given ¦Ë, ¦Ì and T.
We would like to investigate the effect of the length of simulation T on the simulation. Let us fix ¦Ë = 0.7 and ¦Ì = 1. For each of the following values of T : 1000, 5000, 10000 and 50000, perform the simulation 20 times (with a different set of random numbers) and record the value of the average mean response time.
Answer the following:
1. What is the mean response time according to the M/M/1 result?
2. For each value of T used, compute the mean and standard deviation over 20 experiments. 3. How does the standard deviation vary with T?
Note the Python file sim mm1 lib.py contains the Python function sim mm1 func(). If you call the function sim mm1 func(0.7,1,1000), it will simulate an M/M/1 queue with ¦Ë = 0.7, ¦Ì = 1 and T = 1000. The easiest is to import the file and then call the function.
Question 2
Write a simulation program (in whatever language you prefer) to simulate an M/M/2 queue. You should be able to control the arrival rate ¦Ë, service rate ¦Ì and the length of simulation T.
Use your M/M/2 and M/M/1 simulation program to compare:
1. The mean response time of an M/M/1 queue with ¦Ë = 0.9 and ¦Ì = 1.
2. The mean response time of an M/M/2 queue with ¦Ë = 0.9 and for each server, ¦Ì = 0.5 .
Simulate each of the above configurations 10 times and record the mean response time in the simulation. You may use a simulation time of T = 1000.
You have learnt in Week 3 that the the first system should have a smaller mean response time. Did your simulation results also suggest a smaller mean response time for the first system?
1