Pharos University in Alexandria Faculty of Engineering Fifth Year Students Computer Engineering Department Spring 2022 – 2023 Modeling and Simulation Course Code: EC 384 Lecturer: Prof. Magdy A. Azim TA: Eng. Nehal Fathi SHEET 04 – answers Q U E U I N G S Y S T E M M / M / 1 / m 1. A Measurements at a network gateway show that packets arrive at a mean rate of 125 packets/sec and are buffered until they can be transmitted. The gateway takes 2 msec on average to transmit a packet. The buffer can hold 13 packets including the packet being transmitted and packets that arrive when the buffer is full are lost. Assuming exponential distributions of all times, we wish to find out if the buffer capacity is sufficient to ensure that less than one packet per million get lost. How small the buffer size can be before the loss rate becomes unacceptable? M/M/1/m 𝜆 = 125 𝑝𝑘𝑡/𝑠𝑒𝑐 1 𝜇 = 2∗10−3 = 500 𝑝𝑘𝑡/𝑠𝑒𝑐 𝜆 125 𝜌 = 𝜇 = 500 = 0.25 Probability of buffer overflow 𝑝13 = (1−𝜌)∗𝜌13 1−𝜌14 = (1−0.25)∗0.2513 1−0.2514 = 1.12 ∗ 10−8 This means that the expected prob. Of packets lost is 0.112 every million packets (within the requirements) ➔ To limit the prob. Of loss to less than 10−6 𝜌𝑛 < 10−6 log(𝜌𝑛 ) < log(10−6 ) 𝑛 ∗ log(𝜌) < log(10−6 ) −6 log(10 ) log(10−6 ) 𝑛> = = 9.96 ≅ 10 𝑏𝑢𝑓𝑓𝑒𝑟𝑠 log (𝜌) log (0.25) 1|Page Pharos University in Alexandria Faculty of Engineering Fifth Year Students Computer Engineering Department Spring 2022 – 2023 Modeling and Simulation Course Code: EC 384 Lecturer: Prof. Magdy A. Azim TA: Eng. Nehal Fathi 2. In a gas station there is one gas pump. Cars arrive at the gas station according to a Poisson process. The arrival rate is 20 cars/hour. An arriving car finding n cars at the station immediately leaves with probability 𝒒𝒏 = 𝒏/𝟒 and joins the queue with probability 𝟏 − 𝒒𝒏 , n=0,1,2,3,4. Cars are served in order of arrival. The service time is exponential with mean 3 minutes. 1 𝜆 = 20 𝑐𝑎𝑟𝑠 𝑝𝑒𝑟 ℎ𝑜𝑢𝑟 = 𝑐𝑎𝑟𝑠 𝑝𝑒𝑟 𝑚𝑖𝑛 3 1 = 3𝑚𝑖𝑛𝑠 → 𝜇 = 0.333 𝑐𝑎𝑟 𝑝𝑒𝑟 𝑚𝑖𝑛 𝜇 a. Write the global balance equation of the system. CUT 1 𝜆 𝜆𝑝0 = 𝜇𝑝1➔ 𝑝1 = 𝜇 𝑝0 = 𝜌𝑝0 CUT 2 3 𝜆𝑝1 + 𝜇𝑝1 = 𝜆𝑝0 + 𝜇𝑝2 4 3 𝜆𝑝1 = 𝜇𝑝2 ➔ 𝑝2 = 0.75 𝜌𝑝1 = 0.75𝜌2 𝑝0 4 CUT 3 1 𝜆 𝜆𝑝1 + 𝜇𝑝3 = 𝜆𝑝2 + 𝜇𝑝2 ➔ 𝑝3 = 0.5 𝑝2 = 0.5 𝜌𝑝2 = 0.5 ∗ 0.75 ∗ 𝜌3 𝑝0 = 0.375𝜌3 𝑝0 4 2 𝜇 3 CUT 4 1 𝜆 𝜆𝑝2 + 𝜇𝑝4 = 𝜆𝑝3 + 𝜇𝑝3 ➔ 𝑝4 = 0.25 𝑝3 = 0.25 𝜌𝑝3 = 0.09375 𝜌4 𝑝0 2 4 𝜇 𝜆 𝜌= =1 𝜇 1 ∑ 𝑝𝑛 = 1 𝑝0 + 𝑝1 + 𝑝2 + 𝑝3 + 𝑝4 = 1 𝑝0 + 𝜌𝑝0 + 0.75𝜌2 𝑝0 + 0.375𝜌3 𝑝0 + 0.09375𝜌4 𝑝0 = 1 𝑝0 = 0.3106 𝑝1 = 0.3106 𝑝2 = 0.233 𝑝3 = 0.116475 𝑝4 = 0.029325 b. Find the probability that the gas pump is idle. 2|Page Pharos University in Alexandria Faculty of Engineering Fifth Year Students Computer Engineering Department Spring 2022 – 2023 Modeling and Simulation Course Code: EC 384 Lecturer: Prof. Magdy A. Azim TA: Eng. Nehal Fathi 𝑝0 = 0.3106 c. Determine the mean number of cars at the gas station. 4 𝑁𝑠 = ∑ 𝑛𝑃𝑛 0 0 ∗ 𝑝0 + 1 ∗ 𝑝1 + 2 ∗ 𝑝2 + 3 ∗ 𝑝3 + 4 ∗ 𝑝4 = 1.24323 𝑐𝑎𝑟𝑠 d. Determine the delay time and the waiting time of all cars arriving at the gas station. 𝑇𝑞 = 𝑇𝑠 − 1/𝜇 𝜆𝑒𝑓𝑓 = 𝜆 ∗ (1 − 𝑝4) 1 𝜆𝑒𝑓𝑓 = ∗ (1 − 0.029325) = 0.32356 3 𝑁𝑠 1.24325 𝑇𝑠 = = = 3.84 𝑚𝑖𝑛 𝜆𝑒𝑓𝑓 0.32356 1 𝑇𝑞 = 𝑇𝑠 − = 3.84 − 0.033 = 0.3509 𝜇 3|Page