Simulating the M/M/1 Queue

This Demonstration shows simulated paths of the M/M/1 queue. Thus, you can see how the number of customers changes with time. You can adjust the initial number of customers, the mean time between arrivals, and the mean service time. The M/M/1 queue is an example of a continuous-time Markov chain.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


Snapshot 1: steady-state situation: the number of customers stays moderate
Snapshot 2: unsteady state: the number of customers has a growing trend
Snapshot 3: the number of customers reaches the value 200
In snapshot 1, the mean service time (2) is smaller than the mean time between arrivals (3). We have a steady-state situation with mean number of customers being 2 and mean time in the system being 6. The server works two-thirds of the time.
In snapshot 2, the mean service time (4) is larger than the mean time between arrivals (3). We have an unsteady state and the number of customers in the system has a growing trend.
In snapshot 3, the number of customers reaches the value 200. The Demonstration only works properly if the number of customers stays below 200. If the number of customers reaches the value 200, the simulation does not allow the population to grow further.
The Demonstration only shows the first 200 steps (arrivals or departures of customers) of the process.
Recall that in an M/M/1 process, the time between arrivals of customers has an exponential distribution. The service time has another exponential distribution. With two of the sliders, you can adjust the means of these distributions. The service station only has a single server.
For the M/M/1 queue, see [1, pp. 262–269]. For simulation of the M/M/1 process and other stochastic processes with Mathematica, see [2, pp. 987–1002].
[1] A. O. Allen, Probability, Statistics, and Queueing Theory with Computer Science Applications, 2nd ed., Boston: Academic Press, 1990.
[2] H. Ruskeepää, Mathematica Navigator: Mathematics, Statistics, and Graphics, 3rd ed., San Diego, CA: Elsevier Academic Press, 2009.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+