# E&CE 418: Tutorial-4 Instructor: Prof. Xuemin (Sherman) Shen

## Presentation on theme: "E&CE 418: Tutorial-4 Instructor: Prof. Xuemin (Sherman) Shen"— Presentation transcript:

E&CE 418: Tutorial-4 Instructor: Prof. Xuemin (Sherman) Shen TA: Ning Zhang Office Hours: Tue. 1:00pm - 3:00pm or by appointment

Problem 1 Customers arrive at a fast food restaurant at a rate of 5 per min and wait to receive their order for an average of 5 mins. With probability 0.5 customers eat in the restaurant and carry out their food without eating with probability 0.5. A meal requires an average of 20 minutes to finish eating. What is the average time a customer spends in the restaurant? What is the expected number of customers in the restaurant? For those customers carrying out their food, they stay in the restaurant with an average of 5 minutes (for waiting). The probability is 0.5. For those customers eating in, they stay with an average of 25 minutes (for waiting and eating). The probability is 0.5. Two situations considered together, the average time a customer spends in the restaurant is We know that customers arrive at a rate of 5. By Little’s law, the average number in the restaurant is

Problem 3 Let X be the amount of time a customer spends in a bank. X is exponentially distributed with the mean of 10 minutes. a) the probability that a customer will spend more than 15 mins in the bank? b) Given that the customer is still in the bank after 10 mins, calculate the probability that she will spend more than 15 mins in the bank and the probability that she will spend another 15 mins in the bank? a) b) Memoryless property: The probability that she will spend another 15minutes in the bank is

Problem 4 A person enters a bank and ﬁnds all of the four tellers busy serving customers. There are no other customers in the bank, so the person will start receiving service as soon as one of the customers in service leaves. Customers have independent, identical, exponential distribution of service time with mean a). The probability that the person will be the last to leave the bank assuming no other customers arrive. b).If the average service time is 1 minute, what is the average time the person spend in the bank? a). The probability that the person will be the last to leave is ¼. Because the exponential distribution is memoryless, and all customers have identical service time distribution. In particular, at the instant the customer enters service , there are 4 persons at service, and the remaining service time of each of the other three customers served has the same distribution as the service time of the customer.

Problem 4 (b) b) .If the average service time is 1 minute, what is the average time the person spend in the bank? The average time in the bank is the average service time (1min) plus the average waiting time before being served. The average waiting time equals to the expected time for the ﬁrst customer to ﬁnish service. Let X be the waiting time for the ﬁrst customer to ﬁnish service, which is a random variable. Let X1,X2,X3 and X4 denote the service time for the customer in the server1,2,3,4, respectively. The CDF of X is given by Which is the CDF of an exponential R.V, with a new The expected waiting time for the ﬁrst departure is 1/4 Average time the person will spend in the bank is 1+1/4=5/4mins.

Problem 5 A communication line capable of transmitting at a rate of 50Kbits/sec is being used to accommodate 10 sessions. Assume that each session generates Poisson traffic at a rate of 150 packets per min. Packets lengths are exponentially distributed with mean 1000bits. a) If the transmission bandwidth is divided into 10 equal bands so that each session transmits in a separate band, ﬁnd the mean number of packets in the queue, the mean number in the system, and the mean transmission delay per packet in the system.

Problem5 (a) Average service time(transmission time) Because the packet length is exponential, the service time is exponential with average 0.2sec. M/M/1 queue : For all sessions

Problem 5(b) b) If the sessions are aggregated into a single buﬀer and transmitted using statistical multiplexing, ﬁnd the mean number of packets in the queue, the mean number in the system, and the mean transmission delay per packet in the system? When statistical multiplexing is used, all sessions are aggregated in one buffer and served by the whole bandwidth.

Problem5 ( b) Average service time(transmission time) M/M/1 queue :
Mean number of packets in queue Mean number of packets in system Average waiting time in the system

Problem 6 A telephone company establishes a direct connection between two cities expecting Poisson traffic with rate 30 calls per minute. The duration of calls are independent and exponentially distributed with mean 3 minutes. How many circuits are needed to ensure that an attempted call is blocked (because all circuits are busy) with probability less than 0.01? It is assumed that blocked calls are lost, i.e., a blocked call is not attempted again. Poisson traffic 30 calls per min. Duration of calls are independent and exponentially distributed with mean 3mins. mean= Telephone networks are circuit switched, which can be treated as M/M/m/m queue. Customers corresponds to the active calls while m servers correspond to m circuits. Erlang’s B formula (refer to ex. 2.3 in handout 2) <0.01, then

Problem 8 Empty taxis pass by a taxi stand at a Poisson rate of 2 per minute and pick up a passenger if one is waiting. Passengers arrive at the taxi stand at a rate of 1 per minute and wait for a taxi only if there are fewer than four persons waiting; otherwise they leave and never return. Draw the state transition diagram and ﬁnd the average waiting time of a passenger who joins the queue. This problem can be described by a M/M/1/4 system. Passengers arrive at a Poisson rate of 1 per minute. These passengers will be served (pick up) by a taxi with a Poisson rate of 2 per minute. Balance equation

Problem 8 The arrival rate of passengers who join the queue
Little’s law:

Problem 9 An athletic facility has ﬁve tennis courts. Players arrive at the courts at a Poisson rate of one pair per 10 mins and use a court for an exponentially distributed time with mean 40 mins. a). Suppose that a pair of players arrive and ﬁnds all courts busy and k other pairs waiting in queue. How long will they have to wait to get a court on the average? b). What is the average waiting time in queue for players who ﬁnd all courts busy on arrival? For each court, the expected time between two departures is 40 mins. If 5 courts are busy, the expected time between two departure is 40/5=8 mins. If a pair sees k pairs waiting in the queue, there must be exactly k+1 departures from the system before they get a court. Since all the courts would be busy during this whole time, the average waiting time required before k +1departures is 8(k +1)minutes.

Problem 9 (b) b). What is the average waiting time in queue for players who ﬁnd all courts busy on arrival? This problem can be described by a M/M/m system. Let X be the expected waiting time given that the courts are found busy and PQ be the probability that all courts are busy. The average time a player pair has to wait can be calculated as: PQ: The probability that all courts are busy is the probability that there are at least 5 pairs in the system. This can be written as Refer to the section3.4.1of”Data Networks” by Dimitri Bertsekas and Robert Gallager. The link is:

 It holds for every work conserving system you will encounter.
Problem9 (b) By Little’s Law Little’s law: N = λT.  It holds for every work conserving system you will encounter.  Can be applied to entire system or any part of it.

Appendix The average number of pairs in the queue Since n +5 >m =5
Substitute Pn+5 in the above equation

Appendix

Thanks !