5 Collector Layer

The collector layer of the process is responsible for the kernel data interface. This layer collects the kernel info objects and receives information requests for these objects. Each type of process (parent, child and application) has its specialized collector layer. The functionality common to all these layers is implemented in the class TCollector (see Reference Manual). All actions of the collector layer are performed within a call of the virtual method Interrupt().

Each collector layer contains a table of tasks (class TCollTask), where it keeps information about requested KI classes. Every task consists of the ID of the requested kernel info class, the most recent kernel info object and set of demands. Each demand consists of requester process PID, retrieval period. The collector layer keeps kernel info object that was registered in its table of tasks. Whenever a retrieval condition is met the object is refreshed to contain the most recent information. The kernel info object is then declared as ready, the object is serialized and sent to the collector layer of the requesting process. The retrieval condition is checked periodically for every registered KI class and requesting process until the request is unregistered. The period of the checkout (retrieval period) is specified by the requesting process. The period can be measured either in seconds (absolute time) or as a count of performed main loops of genetic algorithm (relative time). There exists one special type of registration (period JUST_ONCE), that retrieves the KI object just once and as soon as possible. The request is then automatically unregistered.

The construction of the KI objects is not performed by the collector layer itself. Whenever the collector layer needs to construct a new KI object, it calls the virtual method CreateKI(). This method returns a newly allocated KI object filled with the actual information. Each layer of the process is responsible for construction of several KI classes. This layer has to override the method CreateKI() and construct KI objects for information it is responsible for.

Whenever one of the process layers needs any piece of information provided by another process (creator process) it has to register a request in collector layer of the local process (requesting process). This collector layer then registers this request in the collector layer of the creator process (by a special message). The KI object is created by the creator process (in fact by one of its layers) and sent back. After the KI object arrives the collector layer of the requesting process declares the object ready for retrieval (method IsKIReady() returns TRUE) . After this the requesting layer then retrieve the collected KI object by calling the method GetKI(). There is one special case of registration: a KI class can be requested within a single process (requesting process and creator process are identical). This case represents a common mechanism of information exchange between the layers of the same process through the interface of the collector layer.

These are the specialized collector layers:

5.1Local Collector Layer

The local collector layer (class TLocalCollector) is the main source of information collected in the kernel. It provides all LKI classes, filled with the actual information on the local child process (e.g. state of its computation).

Request Registration and Unregistration

Only LKI class can be registered in the local collector layer. This registration can be performed by any layer of the same child process by these methods:

Where id is ID of the requested LKI class and period is the retrieval period (relative time).

Retrieval Condition

The LKI object is prepared for retrieval whenever the retrieval period has elapsed.

5.2Global Collector Layer

The global collector layer (class TGlobalCollector) is responsible for the kernel data interface. Through this layer the application processes (or parent) can register their requests of GKI classes supported by the kernel data interface. These GKI objects are then filled with the actual information about the whole kernel. Exactly a GKI object contains in special data structure (class TBag) LKI objects collected from all child processes. Optionally it can contain some global attributes. These GKI objects are sent out of the kernel to the requesting application processes.

Request Registration and Unregistration

Only GKI class can be registered in the global collector layer. This registration can be performed by any layer of the same parent process. After the registration of a GKI object all corresponding LKI classes are automatically registered in all child processes. These are the (un)registration methods:

Where id is ID of the requested GKI class. Parameter period1 is the retrieval period of the GKI object (absolute time). Parameter period2 is the retrieval period of the LKI objects in child processes. Parameter time specifies the measure of the parameter period2: TRUE means absolute time, FALSE relative time. We suggest to use WHEN_READY as value of period1, so the retrieval condition is checked only after arrival of a new LKI object. JUST_ONCE can be used as a value of period1. In this case requests for LKI classes in child processes are automatically unregistered after the first retrieval. Nevertheless the request of GKI class should be unregistered after the first retrieval.

Retrieval Condition

The GKI object is prepared for retrieval whenever it says so (TGlobalKI::IsReady() returns TRUE) and the retrieval period has elapsed. Standard implementation of the method TGlobalKI::IsReady() is: return TRUE if all LKI objects from all child processes have arrived.

5.3Application Collector Layer

The application collector layer (class TAppCollector) is a simple layer providing communication between an application process and the data interface of kernel. This layer does not construct any KI objects, it can only request and retrieve them.

Request Registration and Unregistration

Only GKI class can be registered in the application collector layer. This registration can be performed by any layer of the application process. After this registration the request is automatically registered through the kernel data interface in the global collector layer of the parent process. These are the methods:

Where id is ID of the requested GKI class. Parameter period1 is the retrieval period of the GKI object (absolute time). Parameter period2 is the retrieval period of LKI objects in child processes. Parameter time specifies the measure of the parameter period2: TRUE means absolute time, FALSE relative time. We suggest to use WHEN_READY as value of period1, so the retrieval condition is checked only after arrival of a new LKI object. JUST_ONCE can be used as a value of period1. In this case requests for LKI classes in child processes are automatically unregistered after the first retrieval. Nevertheless the request of GKI class should be unregistered after the first retrieval.

Retrieval Condition

The GKI object is prepared for retrieval immediately after its arrival from the parent process.

Programmer's Guide Project Antares