written by Dave Krahl, QMT Group
In computer science and engineering a race condition is "an
undesirable situation that occurs when a device or system attempts to
perform two or more operations at the same time, but because of the
nature of the device or system, the operations must be done in the
proper sequence to be done correctly". In
discrete event simulation programs such as ExtendSim, a race condition
is when multiple events happen at the same simulated time and the order
of these events has an impact on the operation of the model. Because
discrete event simulators process events at discrete times, race
conditions are fairly common. There is no standard solution to this, and
it is handled differently by the various simulation software programs.
When an event occurs in a discrete event simulation model any number of
actions can be triggered. The order of these actions can have a
significant effect on the behavior of the model. A classic example is if
a resource is released and the item (or entity) releasing that resource
requests the same resource again and other items are waiting for that
resource. Is the releasing item in contention for the resource?
ExtendSim
has a number of features that provide additional control over the
sequence and scheduling of events as well as the transmission of
messages. These include:
- Scheduling a 0 time event in an equation before it is evaluated. This provides the ability to delay the calculation of the equation and any subsequent messages sent by the equation returning control to the block that initiated the calculation. This can be implemented in custom blocks as well.
- Detailed control of messages in the equation and custom blocks. Whether or not a connector responds to a message is a user-defined option.
- In custom blocks, there are message handlers for every type of interaction. These can be used to control how other messages are sent out.
While
there are numerous tools for solving race condition problems, the
biggest challenge is detecting them in the first place. This often
requires detailed inspection of the results of an event in the
simulation. Some tools available for this in ExtendSim are:
- Tracing of simulation execution
- Enabling debugging code and in particular examining the "stack" of function calls and message handlers
- Animation of item movement
- Record Message block in the ExtendSim Utilities library shows sequences of messages
- History block that shows item movement and properties.
Race
conditions are an artifact of discrete event simulation as a
technology. This issue is something that every experienced simulation
modeler has encountered in their modeling experience. Identifying the
race condition can be challenging. However, tools exist in simulation
programs to address any race condition problems and control the
execution of the model.
No comments:
Post a Comment