When a new communicator is created it must be assigned a collectively unique context ID. Generating the new context ID is a collective operation over the communicator from which the new one is being derived.
The basic mechanism for creating a new context ID is to first find the maximum context ID currently in use by any process involved in the new context creation. The new context ID is then this maximum plus one. Each process involved is informed of the new context ID which is also the new process maximum.
In the descriptions of the collective algorithms which create new contexts it is assumed that each process keeps track of the maximum context ID it has in use in the variable
IMPI_Uint8 IMPI_max_cid;
which is initialized in MPI_Init().
In systems with limited context ID space the agent for each process can maintain a mapping between the limited space and the 64-bit IMPI space.(End of advice to implementors.)