As part of the execution of the cds_init operation, a process is:
As will be discussed shortly, no process (including the enlistor) is provided with a process ID for the new process. As a result, the new process is initially completely anonymous and therefore its cell(s) cannot be targeted by other processes, but the new process can target cells in other processes--specifically, those within its enlistor, or within other processes if their process IDs were included within the region that was placed within the new process's single cell .
This period of anonymity for the new process (before informing the world of its presence) allows it to set itself up properly. First, it can add one or more new contexts which other processes will expect to be present, using the cds_mkcntxt operation discussed in a later section. This will also serve to enlarge the comm heap. Next, it can assign handlers to cells, as it sees fit. Only when these have been performed will it normally enq a region containing its process ID into a cell in one or more other processes which it knows about (e.g. its enlistor), allowing the rest of the program to begin integrating it with the rest of the computation. This region, indicating the identity of the new process to others, is sometimes known as a "birth cry" or "I AM HERE" message.
Now, switching to the perspective of the enlistor, new processes are added to the program using the cds_enlist operation. This operation allows the enlistor to specify a computational resource (e.g. one or more processors), a specification of one or more not-yet-initiated or already-initiated (but not-yet-enlisted) processes, a process number (to be provided to one of the new processes and incremented as necessary to provide a unique sequential number to each), and an optional region to be "broadcast" to each process (as if with an enqm operation). cds_enlist is a non-blocking operation: it does not (necessarily) wait for specified processes to start up, nor does it return any sort of value to indicate whether or not the processes started up correctly (though standard argument checking is performed). This theoretically allows the enlistor to proceed to enlist other processes even before the previous ones have completely been "born". It is therefore up to the program (often in the enlistor) to wait for and count the appropriate number of birth cries to know that an enlist operation has succeeded. (This often motivates writing the program in a manner that assumes that all has gone right until it is determined that something has gone wrong.)
Process IDs are handles, and therefore are similar, in many ways, to Unix FILEs. Each is a small integer (which is typically an index into an internal table containing more specific information). Also like UNIX files, two process IDs having the same numerical value but being held in two separate processes may not both represent the same process. Partially for this reason, when these IDs must be moved from one process to the next, communicating the numeric value is not sufficient, so there is a special CDS data type for process IDs (CDS_PID), which can be used just as any other type in the CDS copy operations. These convert between the numeric form of the process ID (when not in the comm heap) to a much longer and more descriptive form (in the comm heap). The programmer is advised to use cds_typlen (e.g. cds_typlen(CDS_PID,0,0) ) to determine how much room a process ID will actually take when copied to a region.
Another CDS operation which is sometimes useful in this context is cds_myinfo, which supplies all of the same return values as cds_init, but without the side-effect of initiating the CDS characteristics of the processor. In other words, it provides an alternate means to determine the enlistor, the process number, and the optional features implemented in this version of CDS.
cds_enlist()
cds_init()
cds_myinfo()
[Arguments to be specified soon]
Copyright 2000 © elepar All rights reserved