Advanced Modelling Features

Interrupts

What Are Interrupts?

   
 

In DESMO-J you may interrupt the execution of a simulation process by calling its interrupt(InterruptCode interruptReason) method. The currently active process can choose to interrupt any other process, conceptually active ones (currently performing a hold()) or conceptually passive ones (currently waiting after having called passivate() on themselves). The interrupted process will be activated directly after the interrupting process returns control to the scheduler.

The InterruptCode object passed as a parameter to the interrupt() method carries information about the reason for the interrupt in the form of an integer value and a String. The interrupted process can then react according to the reason. Note that a model designer has to explicitly define the handling of interrupts in the process' life cycle.

A typical example for the use of interrupts is a queueing scenario where high-priority customers interrupt the server in the service of lower-prioritised customers. We will return to the simple model of a container terminal loading zone from the Processes Step by Step section to demonstrate interrupts in DESMO-J.



   
  http://desmoj.sourceforge.net/tutorial/advanced/interrupt0.html