Package Overview

The Intrpt (Interrupt) package is a collection of Kernel Procedures concerned with providing a process with information about incoming interrupts, and the ability to schedule outgoing interrupts.

When a process is invoked by an interrupt, it usually is in a state in which it expects a limited set of interrupts. The first concern of the process will be to determine the type of the incoming interrupt, so that it can tailor subsequent processing appropriately. The KP op_intrpt_type() provides the process with an integer code that represents the type of the current interrupt; this code can be compared with the constants in Table 59 “Interrupt Type Symbolic Constants“ on page 15.

Self, remote, or multicast interrupts can have many different purposes. For instance, a single process might schedule self interrupts to model various kinds of processing delays and time-out intervals. To distinguish the purpose of such interrupts, and hence provide the receiving process with context-sensitive processing ability, an integer code is associated with self, remote, procedure call, process, and multicast interrupts. The code of the current incoming interrupt is available from the KP op_intrpt_code().

Stream interrupts are caused by packets arriving on input streams. Packets can be sent between modules in three basic modes: scheduled (regular or delayed), forced, and quiet. The quiet mode does not “announce” the packet arrival with an interrupt to the destination module, thus allowing the packet to queue in the input stream. However, the scheduled and forced modes do associate interrupts with each packet. When a process is interrupted by a stream interrupt, it usually determines the input stream on which the packet arrived by calling the KP op_intrpt_strm().

Statistic interrupts are caused by triggers responding to specific types of changes in the value of module statistics. When a process is invoked by a statistic interrupt, it needs to determine which input statistic is associated with the interrupt; this service is provided by the KP op_intrpt_stat(). Note that this KP does not provide information about the statistic (such as its name or the triggering condition); it only provides the numeric index of the input statistic.

Most types of interrupts originate at a specific module. Stream interrupts originate at the module which generated or forwarded the arriving packets. Self and remote interrupts originate at the module that schedules them. In order to obtain the object ID of the module (or link or node in the case of failure and recovery interrupts) which is the source of the current interrupt, the KP op_intrpt_source() can be used. Three types of interrupts do not have source objects: the begin simulation, end simulation, and regular interrupts.

Interrupts that originate at processes can have an associated ICI (Interface Control Information) that conveys data about the interrupt and possibly the type of service requested. For instance, a process that represents a high-layer protocol can forward a packet and associated ICI to a lower-layer protocol; the packet contains high-layer format, peer-to-peer data, while the ICI contains information about which services should be applied to the packet. ICIs are manipulated by Ici Package KPs, both in the originating process and the receiving process. The Ici KP op_ici_install() binds the specified ICI with outgoing interrupts at the originating process. On the opposite side, the KP op_intrpt_ici() obtains an ICI associated with an incoming interrupt.

Data also can be passed via client states associated with events. You can get the state information for the current event with op_intrpt_state_ptr_get().

Self interrupts are an important modeling tool which allow a process to schedule its own activity at some future time. Typical uses of self interrupts include time-out intervals, processing delays, and stochastic traffic generation. The KP op_intrpt_schedule_self() schedules a single self interrupt at a specified simulation time, with a specified numeric code. The KP op_intrpt_schedule_self_mt() also schedules a self interrupt, but in addition the client guarantees the interrupt event to be MT-safe and eligible for parallel execution regardless of normal MT-safety considerations.

Procedure interrupts provide processes with the capability of scheduling general activities at some future time. This feature makes interfacing to externally prepared C code convenient, because a simulation event can be tied to a call to an arbitrary C function. The KP op_intrpt_schedule_call() schedules a single procedure interrupt at a specified simulation time, with a specified numeric code and data structure pointer for conveying information to the procedure. (op_intrpt_schedule_call_mt() provides the same functionality in an MT-safe version that can be used in parallel simulations.) The KPs op_intrpt_code(), op_intrpt_source(), and op_intrpt_ici() all are functional when invoked from a procedure that has been scheduled.

Process interrupts let cooperating processes invoke one another as needed. This also can be done with op_pro_invoke(), but only for immediate calls. The KP op_intrpt_schedule_process() provides the ability to invoke a process at a later simulation time and also supports invocation of processes outside the current module.

Remote interrupts provide a means of inter-process communication that is especially useful when two modules are not directly connected. Typical uses of remote interrupts are: centralized failure and recovery modeling, “out-of-band” communication for routing or network management data that is not significant as extra loading, and first-cut peer-to-peer network modeling. Two KPs cause remote interrupts

Both of these KPs take an numeric code argument which is associated with the remote interrupt.

Multicast interrupts provide a means of inter-process communication in a broadcast manner. One process can send an identical interrupt to every process in the simulation. The KP op_intrpt_schedule_mcast_global() schedules one multicast interrupt at every processor and queue module in a logical set and returns an Evhandle that can be stored in a state variable. That Evhandle can be used to cancel the entire logical set of multicast interrupts via the KP op_ev_cancel().

Esys interface interrupts occur in cosimulations when values arrive on output esys interfaces of an external system and are made available to a module. When a process is interrupted by an esys interface interrupt, it usually determines the interface on which values have been placed by calling the KP op_intrpt_esys_interface().

Interrupts that have been scheduled sometimes become obsolete before they arrive. For instance, a process might schedule a time-out interval for five minutes, only to be interrupted two minutes later by an arriving packet. Because the time-out has become unnecessary, the possible arrival of the pending interrupt is an inconvenience that would require special handling by the process model. The KP op_ev_cancel() eliminates the need to specially handle interrupts that have lost significance. This KP cancels a pending interrupt, based on its Evhandle, a special data structure that identifies a specific interrupt. Evhandles are returned by a number of KPs that schedule interrupts, including: op_intrpt_schedule_self(), op_intrpt_schedule_call(), and op_intrpt_schedule_remote().

Scheduled interrupts are not processed if the simulation ends before they are reached. Also, after the simulation kernel begins processing end of simulation events, new interrupts for the current time will be placed in the event queue, but not processed.

The ability to maintain multiple processes in a single queue or processor module raises the issue of determining which process will be invoked by the Simulation Kernel to handle an incoming interrupt. By default, the root process of the module (the only process that can exist prior to receipt of the first interrupt) will be the recipient of all interrupts. However, facilities are provided to allow automatic redirection of these interrupts to particular processes within the module, based on user-defined criteria. Processes can manage interrupt redirection properties of their own module via three KPs.

The KP op_intrpt_type_register() allows processes to be designated as direct recipients of interrupts based on the type of interrupt occurring (i.e., a process can be designated as the primary process to be invoked whenever a regular interrupt occurs). The KP op_intrpt_port_register() allows still more specificity in selecting interrupts by allowing designation of a process as the recipient of stream or statistic interrupts arriving on a particular input. This KP is only useful for the management of stream and statistic interrupts. Finally, the KP op_intrpt_port_deregister() allows reversal of the effect of op_intrpt_port_register().

Processes sometimes enter states requiring that they reset themselves, similar to a computer “booting”. In such cases, all pending self interrupts might be unnecessary. The KP op_intrpt_clear_self() cancels all pending interrupts for a process, without requiring specific identification for each one. This KP is a more convenient alternative to op_ev_cancel() when multiple self interrupts are pending.

Processes often are used to model tasks executing on a computer with limited computational bandwidth, resulting in a non-negligible processing delay for specific computations. While a process is modeling the delay of a computation (usually modeled via a self interrupt), it should not be preempted by incoming interrupts. A process has the capability of disabling individual types of incoming interrupts for an interval (causing them to be ignored), and then reenabling incoming interrupts at a later time. The KP op_intrpt_disable() specifies that a particular type of interrupt, with a particular numeric code value, will be disabled. The KP op_intrpt_enable() negates the effects of op_intrpt_disable(). These two KPs give precision control over which interrupts will be ignored. The additional KP op_intrpt_enable_all() enables all interrupt types in one convenient call.

In sequential simulations, interrupts arrive at a process in time order. That is, an interrupt scheduled for an earlier time will arrive before an interrupt scheduled for a later time. However, it is possible that two or more interrupts might be scheduled at the same process for the same instant in time. An interrupt that has a higher priority will arrive before an interrupt with a lower priority. Interrupt priorities are integer values and, at the start of the simulation, have a default value of 0. If several interrupts have the same priority, the interrupt scheduled first arrives first. This is termed natural order. Interrupt priorities for sequential simulations can be set via two KPs: op_intrpt_priority_set() sets the priority for a type of interrupt at the calling process and op_intrpt_priority_set_next() sets the priority for a type of interrupt only for the next occurrence. The KP op_intrpt_priority_get() is useful for monitoring the priority values. (These interrupt priority KPs are not supported for parallel simulations.)