CS计算机代考程序代写 matlab Solution to COMP9334 Revision Questions for Week 4A

Solution to COMP9334 Revision Questions for Week 4A
Question 1
First note that one counter is not sufficient to serve all the customers. If we consider all the customers together, each customer carries on average 20.5 items, which takes 20.5 to complete.
15
Since the customer arrival rate is 1, the utilisation will be above 1 if only one counter is used. Let us refer to the two counters as Counter 1 and Counter 2. Let us assume that Counter 1 serves customers with x items or less and Counter 2 serves customers with more than x
items, where 1 ≤ x ≤ 39.
Let λ(= 1) denote the overall arrival rate and μ = 15 be the service rate of each counter.
Let us consider Counter 1 first. Since only customers with x items or less go to Counter 1, the arrival rate at Counter 1 is λ x . The customers arriving at Counter 1 bring with them
40
1, 2, …, x items uniformly distributed. Let S1 denote the service time at Counter 1. We have
E[S1] = 􏰂x i1 (1) i=1 μx
E[S12] = 􏰂x 􏰉i􏰊2 1 (2) i=1 μ x
Let ρ1 = λ x E[S1], by the P-K formula, the mean waiting time at Counter 1 is 40
􏰏λx E[S12] W1 = 40 2(1−ρ1)
ifρ1<1 if ρ1 ≥ 1 (3) Similarly, the arrival rate to Counter 2 is λ2 = λ 40−x . Let S2 denote the service time at Counter 2, then ∞ 40 i 1 E[S2] = 􏰂 (4) 40 W2 = The mean waiting time of the customers is 40 E[S2] = 􏰂 􏰉 i 􏰊2 μ 1 (40 − x) (5) (6) i=x+1 μ (40 − x) i=x+1 Let ρ2 = λ40−xE[S2], by the P-K formula, the mean waiting time at Counter 2 is 40 􏰏λ40−x E[S2] 40 2(1−ρ2) ifρ2<1 if ρ2 ≥ 1 ∞ W = xW1+40−xW2 (7) 40 40 Note that W is a function of x. We write a computer program (Matlab file week04A q1.m) to calculate how W varies with x. Figure 1 shows how W varies with x. It can be seem that the minimum value of W is achieved at x = 28. 1 80 70 60 50 40 30 20 10 0 20 22 24 26 28 30 32 34 x Question 2 Figure 1: For Question 1 The system behaves as an M/G/1 queueing system. Since there are 10 sessions each generating Poisson traffic at a rate of 150 packets/minute, the packet arrival rate to the communication line is 1500 packets/minute or 25 packets/s (= λ). With a transmission rate of 50 kbits/s, a 100-bit packet requires a transmission time (= service time in queueing theory terminology) 0.002s and a 1500-bit packet requires a trans- mission time of 0.03s. (Recall that transmission time is packet size divided by transmission rate.) Given that 10% of the packets are 100 bits long and the rest are 1500 bits long, the mean service time E[S] (where S denotes the service time random variable) E[S] = 0.1 ∗ 0.002 + 0.9 ∗ 0.03 = 0.0272s (8) and the second moment of the service time is E[S2] = 0.1 ∗ 0.0022 + 0.9 ∗ 0.032 = 8.1040 × 10−4s2 (9) The mean waiting time W , according to the P-K formula, which applies to M/G/1 queue- ing system, is W = λE[S2] = 31.7ms (10) 2(1 − λE[S]) 2 meaning waiting time By Little’s Law, the mean queue length is given by the product of the throughout of the queue and the mean waiting time, λ ∗ W = 0.7914 packets (11) 3