Main Content

Queue and Service

FIFO queue, LIFO queue, priority queue, delay modeling, entity storage, buffering

In a discrete-event simulation, queueing blocks store entities for a length of time that cannot be determined in advance. Queuing blocks attempt to output entities when possible, but its output depends on whether the downstream block accepts new entities. An everyday example of a queue is people waiting in line for a store register. A shopper cannot determine in advance how long they will have to wait to complete their purchase. The Entity Queue block is one of the queueing blocks provided in the SimEvents® library that can sort entities in a queue based on a sorting policy. You can model FIFO queue, LIFO queue, and priority queue. For more information, see Model Basic Queuing Systems.

You can use queue and server blocks provided in the SimEvents library to model basic or complex queue-server systems. Server blocks store and delay entities for a specified length of time then attempt to output entities. An everyday example of a server is processing parts for a certain period of time in a factory assembly line. In this case, server delay can represent the duration of a thermal process. The Entity Server block is one of the server blocks that stores and services entities, and then attempts to output them.

You can also create more advanced queuing systems using discrete-event System object™ and Discrete-Event Chart block.


expand all

Entity QueueEnqueue messages and entities
Entity StoreStore entities
Entity ServerServe entities
Entity Transport DelayIntroduce a delay in propagation of a SimEvents message
Conveyor SystemTransport entities


Basic Queuing Systems

Overview of Queues and Servers in Discrete-Event Simulation

Model storage with queues and servers, use serial or parallel queue-server pairs.

Model Basic Queuing Systems

Use FIFO queue, LIFO queue, priority queue, and servers to model queueing systems.

Broadcast Entities using Entity Multicasting

Send, receive, transport, and multicast entities wirelessly.

Applications of Basic Queuing Systems

Use Queue Event Actions to Model a Storage Tank

This example shows how to use Entity Queue block event actions, a Simulink Function block, and an Entity Gate block to model a bottle storage system with a limited capacity.

Serve High-Priority Customers by Sorting Entities Based on Priority

This example shows how to minimize the time required to serve high-priority customers by using a priority queue and Entity Input Switch and Entity Output Switch blocks.

Model Traffic Intersections as a Queuing Network

This example shows how to create a SimEvents® model to represent a vehicle traffic network and to investigate mean waiting time of vehicles when the network is in steady-state.

Model Preemption and Server Failure

Model Server Failure

Using Stateflow® charts to model the behavior of a server that requires maintenance.

Task Preemption in a Multitasking Processor

Model server task preemption for low priority tasks.

Model Advanced Queuing Systems with Custom Behavior

Create Custom Blocks Using MATLAB Discrete-Event System Block

Author discrete-event System object by defining entity types, ports, storage, and events.

Flush Entities from a Queue-Server

This example shows how you can use a Discrete-Event Chart block to model a queue-server that can flush entities when it receives a message on the "FlushCmd" port.