# Queuing Exercises Sheet 2

## Exercise 1

For M/M/1/B the book gives this formula: ${\displaystyle E[n]={\frac {\rho }{1-\rho }}-{\frac {(B+1)\rho ^{B+1}}{1-\rho ^{B+1}}}}$ on page 539.

### Variant 1

Here is my attempt at a solution:

Taking from the book that for M/M/1/B ${\displaystyle p_{n}={\frac {1-\rho }{1-\rho ^{B+1}}}\rho ^{n}}$ (I sure hope they give us this equation on the exam :))

Calculate E[n] like this:

${\displaystyle E[n]=\sum \limits _{n=1}^{B}np_{n}={\frac {1-\rho }{1-\rho ^{B+1}}}\sum \limits _{n=1}^{B}n\rho ^{n}={\frac {1-\rho }{1-\rho ^{B+1}}}S}$

${\displaystyle S=\rho +2\rho ^{2}+3\rho ^{3}+\cdots +B\rho ^{B}}$

${\displaystyle \rho S=\rho ^{2}+2\rho ^{3}+\cdots +B\rho ^{B+1}}$

${\displaystyle S-\rho S=(1-\rho )S=\rho +\rho ^{2}+\rho ^{3}+\cdots +\rho ^{B}+\rho ^{B+1}-\rho ^{B+1}-B\rho ^{B+1}={\frac {\rho (1-\rho ^{B+1})}{1-\rho }}-(B+1)\rho ^{B+1}}$

${\displaystyle E[n]={\frac {1}{1-\rho ^{B+1}}}[{\frac {\rho (1-\rho ^{B+1})}{1-\rho }}-(B+1)\rho ^{B+1}]={\frac {\rho }{1-\rho }}-{\frac {(B+1)\rho ^{B+1}}{1-\rho ^{B+1}}}}$

### Variant 2

Here an other solution if you haven't got any formulas:

${\displaystyle \sum \limits _{n=0}^{B}p_{n}=1<=>\sum \limits _{n=0}^{B}\rho ^{n}p_{0}=1<=>p_{0}\sum \limits _{n=0}^{B}\rho ^{n}=1}$

Considering geometric rows formula: ${\displaystyle \sum \limits _{x=0}^{y}m^{x}=(1-m^{y+1})/(1-m)}$

${\displaystyle p_{0}\sum \limits _{n=0}^{B}\rho ^{n}=1<=>p_{0}{\frac {1-\rho ^{B+1}}{1-\rho }}=1}$

Solved after ${\displaystyle p_{0}}$:

${\displaystyle p_{0}={\frac {1-\rho }{1-\rho ^{B+1}}}}$

${\displaystyle E[n]=\sum \limits _{n=1}^{B}np_{n}=\sum \limits _{n=1}^{B}n\rho ^{n}p_{0}}$

So:

${\displaystyle {\frac {d}{d\rho }}(\sum \limits _{n=0}^{B}\rho ^{n})={\frac {d}{d\rho }}({\frac {1-\rho ^{B+1}}{1-\rho }})<=>}$

${\displaystyle \sum \limits _{n=0}^{B}n\rho ^{n-1}={\frac {-(B+1)\rho ^{B}(1-\rho )+1-\rho ^{B+1}}{(1-\rho )^{2}}}<=>}$

${\displaystyle \sum \limits _{n=0}^{B}n\rho ^{n}={\frac {\rho -(B+1)\rho ^{B+1}(1-\rho )+1-\rho ^{B+2}}{(1-\rho )^{2}}}}$

${\displaystyle E[n]=\rho _{0}\sum \limits _{n=1}^{B}n\rho ^{n}={\frac {1-\rho }{(1-\rho )^{B+1}}}times{\frac {\rho -(B+1)\rho ^{B+1}+B\rho ^{B+2}}{(1-\rho )^{2}}}=>}$

${\displaystyle E[n]={\frac {\rho -(B+1)\rho ^{B+1}+B\rho ^{B+2}}{(1-\rho )(1-\rho ^{B+1})}}}$

## Exercise 2

We have to show that the average response times for M/M/1 scenario are greater than the M/M/5 scenario. I used the examples 31.2 and 31.4 to figure this out.

If we choose to model the system as M/M/5, in order to get E[r] we need to use the formulas on pages 528 and 529 (everything is known).

arrival_rate = 10 j/s

service_rate = 10 j/s

1. Calculate probability of zero jobs in system (=0.3678)

2. Calculate probability of queueing (=0.00383125)

3. Calculate E[r] for our M/M/m queue (=0.1sec)

If we choose to model the system as five separate M/M/1-s we have the following data

arrival_rate = 2 j/s (we split it 5-ways)

service_rate = 10 j/s

Using the M/M/1 forumla for E[r] we get that the mean response time is 0.125sec. Since 0.1sec for M/M/5 is less than the 0.125sec for the M/M/1 we conclude that it's better to implement it as a M/M/5.

## Exercise 3

For M/M/m the traffic intensity is calculated with: ${\displaystyle \rho ={\frac {\lambda }{m\mu }}}$

For M/M/1 the traffic intensity is calculated with: ${\displaystyle \rho ={\frac {\lambda }{\mu }}}$ but the arrival rate needs to be split between the servers: ${\displaystyle \lambda _{i}={\frac {\lambda }{m}}}$

The traffic intensity of both systems is then: ${\displaystyle \rho ={\frac {\lambda }{m\mu }}}$

## Exercise 4

Using Operational Law U=X*S we have X = 400/s and S = 0.002s

Then U = 0.8 (80%)

Is it really that trivial? I would say! A different approach: The service rate (mu) is observed requests per second. 2000 requests divided by 5 seconds = 400 requests/second. The you compute the utilization as percentage: observed service rate over max. service rate * 100: 400/500*100 = 80 %

## Exercise 5

We also use U=X*S, where U=0.5 all the time. We have two different values for S (0.005s, 0.00125s) which gives the two different Throughput results:

X1 = 100/s and X2 = 400/s

Or even simpler: We have given the full throughput, if utilization is only .5 we can also half the throughput. That gives us a throughput range from 100 (=200/2) to 400 (=800/2) requests per second.