next up previous
Next: Proxy entities Up: JiST- Java in Simulation Previous: Simulation time invocation

Timeless objects

Having exhausted our hello simulation and discussed the central notion of simulation time invocation, we now introduce more advanced JiST features and add complexities to the basic model. Our first extension is the notion of timeless objects, introduced purely for reasons of performance. A timeless object is defined as one that will not change over time. Knowing that a value is temporally stable, allows the system to safely pass it across entities by reference, rather than by copy.

The system may be able to infer that an object is open-world immutable, through static analysis and automatically add the timeless labels. In some cases, the analysis can be overly conservative due to restrictions of the Java type system. The programmer can then explicitly define an object to be timeless, by tagging the object with the empty JistAPI.Timeless interface. This tag implies that the object will not be modified in the simulation's future, even though it technically could be.

The timeless tag may also be useful for sharing state among entities in an effort to reduce simulation memory consumption, as depicted in Figure 5. This facility should be exercised with care. Since entities may progress at different rates through simulation time, any shared state must actually be timeless. Objects with temporally unstable values shared across entities will create temporal inconsistencies in the state of the simulation. Conversely, the simulation developer should be aware that non-timeless objects are passed across entities by copy. Thus, it is not possible to transmit information back to the caller using an object parameter in an event. Two separate events should be used instead.

Figure 5: Objects passed across entities should be timeless - in other words, should hold temporally stable values - to prevent temporal inconsistencies in the simulation state. Sharing timeless objects among entities is an effective way to conserve simulation memory.

next up previous
Next: Proxy entities Up: JiST- Java in Simulation Previous: Simulation time invocation