ArticleslgStudy

computer science

Discrete-event simulation

Discrete-event simulation is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Discrete-event simulation rather than just read about it. In short: A discrete-event simulation (DES) models the operation of a system as a (discrete) sequence of events in time. Each event occurs at a particular instant in time and marks a change of state in the system.

Key takeaways

  • Discrete-event simulation belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Discrete-event simulation to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Discrete-event simulation from memory before moving on to harder problems.

Reference excerpt

A discrete-event simulation (DES) models the operation of a system as a (discrete) sequence of events in time. Each event occurs at a particular instant in time and marks a change of state in the system. Between consecutive events, no change in the system is assumed to occur; thus the simulation time can directly jump to the occurrence time of the next event, which is called next-event time progression. In addition to next-event time progression, there is also an alternative approach, called incremental time progression, where time is broken up into small time slices and the system state is updated according to the set of events/activities happening in the time slice. Because not every time slice has to be simulated, a next-event time simulation can typically run faster than a corresponding incremental time simulation. Both forms of DES contrast with continuous simulation in which the system state is changed continuously over time on the basis of a set of differential equations defining the rates of change for state variables. In the past, these three types of simulation have also been referred to, respectively, as: event scheduling simulation, activity scanning simulation, and process interaction simulation. It can also be noted that there are similarities between the implementation of the event queue in event scheduling, and the scheduling queue used in operating systems.

Example A common exercise in learning how to build discrete-event simulations is to model a queueing system, such as customers arriving at a bank teller to be served by a clerk. In this example, the system objects are customer and teller, while the system events are customer-arrival, service-start and service-end. Each of these events comes with its own dynamics defined by the following event routines:

When a customer-arrival event occurs, the state variable queue-length is incremented by 1, and if the state variable teller-status has the value "available", a service-start follow-up event is scheduled to happen without any delay, such that the newly arrived customer will be served immediately. When a service-start event occurs, the state variable teller-status is set to "busy" and a service-end follow-up event is scheduled with a delay (obtained from sampling a service-time random variable). When a service-end event occurs, the state variable queue-length is decremented by 1 (representing the customer's departure). If the state variable queue-length is still greater than zero, a Service-Start follow-up event is scheduled to happen without any delay. Otherwise, the state variable teller-status is set to "available". The random variables that need to be characterized to model this system stochastically are the interarrival-time for recurrent customer-arrival events and the service-time for the delays of service-end events.

Components

State A system state is a set of variables that captures the salient properties of the system to be studied. The state trajectory over time S(t) can be mathematically represented by a step function whose value can change whenever an event occurs.

Clock The simulation must keep track of the current simulation time, in whatever measurement units are suitable for the system being modeled. In discrete-event simulations, as opposed to continuous simulations, time 'hops' because events are instantaneous – the clock skips to the next event start time as the simulation proceeds.

Events list

The simulation maintains at least one list of simulation events. This is sometimes called the pending event set because it lists events that are pending as a result of previously simulated event but have yet to be simulated themselves. An event is described by the time at which it occurs and a type, indicating the code that will be used to simulate that event. It is common for the event code to be parametrized, in which case, the event description also contains parameters to the event code. The event list is also referred to as the future event list (FEL) or future event set (FES). When events are instantaneous, activities that extend over time are modeled as sequences of events. Some simulation frameworks allow the time of an event to be specified as an interval, giving the start time and the end time of each event. Single-threaded simulation engines based on instantaneous events have just one current event. In contrast, multi-threaded simulation engines and simulation engines supporting an interval-based event model may have multiple current events. In both cases, there are significant problems with synchronization between current events. The pending event set is typically organized as a priority queue, sorted by event time. That is, regardless of the order in which events are added to the event set, they are removed in strictly chronological order. Various priority queue implementations have been studied in the context of discrete event simulation; alternatives studied have included splay trees, skip lists, calendar queues, and ladder queues. On massively-parallel machines, such as multi-core or many-core CPUs, the pending event set can be implemented by relying on non-blocking algorithms, in order to reduce the cost of synchronization among the concurrent threads. Typically, events are scheduled dynamically as the simulation proceeds. For example, in the bank example noted above, the event CUSTOMER-ARRIVAL at time t would, if the CUSTOMER_QUEUE was empty and TELLER was idle, include the creation of the subsequent event CUSTOMER-DEPARTURE to occur at time t+s, where s is a number generated from the SERVICE-TIME distribution.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Discrete-event simulation

Start with the simplest possible case. Write down what Discrete-event simulation claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Discrete-event simulation before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Discrete-event simulation ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Discrete-event simulation

In research
Discrete-event simulation appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Discrete-event simulation in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Discrete-event simulation is common in secondary-school and first-year university syllabi. It links to neighbouring topics Events (computing), Stochastic simulation, so understanding it makes those chapters shorter.
In everyday life
Look for Discrete-event simulation outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Discrete-event simulation” →

How to study Discrete-event simulation in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Discrete-event simulation means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Discrete-event simulation out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Discrete-event simulation in simple terms?

A discrete-event simulation (DES) models the operation of a system as a (discrete) sequence of events in time. Each event occurs at a particular instant in time and marks a change of state in the system.

Why does Discrete-event simulation matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Discrete-event simulation?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Discrete-event simulation.

Tags

  • Events (computing)
  • Stochastic simulation

Keep exploring