Rotate the screen

Model of M/M/1 queue

M/M/1 queue system in terms of quequeing theory

M/M/1 queue system is a classical example of queueing theory. The system consists of a queue with FIFO discipline and an single server. Entities are arrived to queue as a Poisson process. The enities from the queue are forwarded to the server. Service time value is exponentially distributed. Queue capacity and timeout (waiting time) are infinite. Queue discipline for M/M/1 queue system is FIFO. Formally, the correct notation should be: M/M/1 FIFO queue system.

Queue discipline determines the processing for the entities arriving to waiting line input and requests for entity from the output. In case of M/M/1 queue system the idle server informs the queue about its status, and if queue is not empty the corresponding entity according with queue discipline is forwarded further to the server.

The abbreviation FIFO stands for "First-In, First-Out". That means that an entity first placed into a queue will first to be retrieved from queue for serving.

Watch the learning video about M/M/1 queue system.
M/M/1 queue

M/M/1 queue system in terms of OpenSIMPLY

This example is only a bit more complicated than the M/M/1 loss system example. Besides "Generator" block for entity generation and "Server" block for entity serving (delay), the M/M/1 queue model requires a "Queue" block responsible for queue discipline.

In Delphi and FreePascal the corresponding classes "TGenerator", "TQueue" and "TServer" will be used.

Download executable models of queueing theory and call centers.
M/M/1 queue block model

Model creation

The variables "Gen", "Que" and "Srv" will be used for instances of TGenerator, TQueue and TServer classes accordingly.

The default values for the "Queue" block for capacity and timeout is "Infinite capacity" and "Infinite timeout". The default value of queue discipline for the "Queue" block is FIFO. Therefore, when creating the "Queue" it is not necessary to explicitly specify the initial parameters.

Model parameters

  • Capacity is the total number of entities for simulation.
  • InterArrivalTime is mean value between entities arrivals.
  • ServiceTime is mean value of service time.
  • ExpTime is a block function returning exponentially distributed random values.

Model behavior

The lines below fully describe the model behaviour for M/M/1 queue system in terms of OpenSIMPLY:

Gen:=TGenerator.Create([Capacity,ExpTime,InterArrivalTime]);  //  Creating a Generator.

Que:=TQueue.CreateDefault;                                     //  Creating an infinite FIFO Queue.

Srv:=TServer.Create([ExpTime,ServiceTime]);                   //  Creating a Server.

Gen.Next:=Que;                                                //  Connecting Generator to Queue.

Que.Next:=Srv;                                                //  Connecting Queue to Server.

To compile a model, the code above should be placed in a standard wrapper of a model as in M/M/1 system example.

Complete program code containing input data and output of results.

program MM1queue;
{$apptype xxx }  // xxx "GUI" or "Console" 

  TMyModel = class(TModel)     //  Model declaration.  
    procedure Body; override;

  Capacity,                    //  Model parameters.  
  NumberOfServers: integer;
  ServiceTime: Double;     

procedure TMyModel.Body;       //  Model description.
  Gen: TGenerator;             //  Blocks declaration. 
  Que: TQueue;  
  Srv: TServer; 
begin                          //  Model behavior.

  Run(Gen);                    //  Starting an initial block.
  Que.ShowStat;                //  Outputting results.

  Capacity:=3000;              //  Initial values of the model.
  Simulate(TMyModel);          //  Starting a model.

To validate the model of M/M/1 queue system, the simulation results can be verified with traffic theory analytics.

The value of queue probability can be obtained with Erlang-C formula.