next up previous contents
Next: Default Value Management Up: 2.3.1 Parameter Structure Previous: Definition of MDL Parameter Types Parameter Linkage Mechanism

A central concept of the Algorithm Library is to optimize the evaluation of model instances by utilizing the initialization phase of the application and model setup in such a way that no further administrative efforts are necessary. Part of this concept is to avoid allocating and copying memory resources for the purpose of exchanging data values between model instances and the application. Furthermore the minimization of temporary Parameter value allocations required for the computation of MDL statements by the MDL interpreter is a major source for runtime minimizations. This is especially required because of the central feature of the MDL language to operate on arbitrary user defined data types, where the effort for the generation of temporary values can not be estimated a priori. The effects of such a concept for performance optimizations are described in detail in [12,56].

Within the Algorithm Library the minimization of initialization and copy operations on memory resources is achieved by administrating the references to the data values of all parameter instances within the Algorithm Library so that the references of ``linked'' parameters address the same physical memory space containing the data value. During the instantiation of a model the interface parameters of the model instance are linked against corresponding parameters of the application interface. For that purpose the Parameter, Interface, and Model classes provide methods which can be used to complete the automatic linkage of interface parameters with equal MDL names and types when an MDL class instance is connected to an external Interface. Linkage recipes can also be defined by using special constructs of the MDL language as described in Section 3.5.

During the linkage of Parameters the Algorithm Library performs rigorous type checks of the involved parameters by using the MDL type information supplied with the involved Parameter instances. Thereby the possibility of errors introduced by faulty MDL commands is considerably derogated. The disadvantage of this linkage management mechanisms is the high CPU time consumption for lookups in the involved hash tables when compared to the CPU time consumption of the instantiation of built-in C++ types. This performance gap provokes that good application design for the Algorithm Library avoids the usage of automatic Parameter variables and relies on the minimization of MDL class instantiations.

To optimize the performance of algorithms operating on Parameter classes, it is possible to link several parameters with an instance of a normal C++ variable of the same type. This may improve the overall speed of simulations when a certain parameter value has to be accessed multiple times within the scope of the application. Since the C++ language contains no automatic garbage collection the application designer is responsible for the correct resource allocation for the thereby linked data value. In particular such a link must not be generated to an automatic C++ variable which comes out of scope before all involved Parameter instances are deleted. Unfortunately C++ has no built-in mechanisms which could be employed to detect such errors which enforces the usage of external heap checking tools [35,44,37]. Fig. 2.2 shows how several parameters of different Model instances are linked to the C++ variable T. Since all these parameters reference the same MDL-memory representation, changing the value of any involved Parameter instance or the variable T itself will affect any subsequent access to all other Parameter instances.

Figure 2.2: Linkage of Parameters

next up previous contents
Next: Default Value Management Up: 2.3.1 Parameter Structure Previous: Definition of MDL Parameter Types
Robert Mlekus