Skip to content
DeepForgeby svx
All problems
EasyProbabilitypr-190

M/M/1 Utilization

Problem

Utilization (traffic intensity) of an M/M/1 queue with arrival rate lam and service rate mu:

rho = lam / mu.

Return 0.0 when mu <= 0 or lam < 0.

Hint

The fraction of time the server is busy is the arrival rate over the service rate.

Test cases

case 1
in: [1,2]
expected: 0.5
case 2
in: [3,4]
expected: 0.75
case 3
in: [0,5]
expected: 0
case 4
in: [1,0]
expected: 0
Starter codePython
def mm1_utilization(lam, mu):
    # Your code here
    pass

4 test cases · run your code against them in the editor