Queues and services

1. What is a queue and a service

In the majority of simulation models there is a need to replicate queuing of some units in front of some type of service. Typical examples are trucks queuing in front of unloading points, people queuing at the cash points of a supermarket, etc.

Such systems are typically represented with a combined object called service consisting of:

  • waiting area, or a queue, and

  • servicing device.

Service

The waiting area can contain infinite number of units. There can be one or several units that are serviced simultaneously.

2. Service classes

Service is an abstract class that models a queue of units waiting for service and the servicing of units itself. One or several units can be served simultaneously. Service automatically keeps track of the queue of units waiting for service and decides what unit must be served next.

Service class has two non-abstract subclasses:

  • FixedCapacityService - a service that can simultaneously process specified number of units. This class automatically decides when to start serving the next unit based on first-in-first-out rule.

  • ManualService - a service that is fully controlled programmatically, i.e. all attempts to start service of a next unit are made externally by calling takeNext() method. Usable when the processed units should be placed in a queue, but the number of concurrently processed units is not important or is determined by some complex external logic.