E.5 Partition Communication Subsystem
This Reference Manual output has not been verified, and may contain omissions or errors. Report any problems on the tracking issue
[The Partition Communication Subsystem (PCS) provides facilities for supporting communication between the active partitions of a distributed program. The package System.RPC is a language-defined interface to the PCS.]
Static Semantics
2The following language-defined library package exists:
with Ada.Streams; -- see 13.13.1
package System.RPC
with Nonblocking => False, Global => in out synchronized is
4type Partition_Id is range 0 .. implementation-defined;
5Communication_Error : exception;
6type Params_Stream_Type (
Initial_Size : Ada.Streams.Stream_Element_Count) is new
Ada.Streams.Root_Stream_Type with private;
7procedure Read(
Stream : in out Params_Stream_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
8procedure Write(
Stream : in out Params_Stream_Type;
Item : in Ada.Streams.Stream_Element_Array);
9-- Synchronous call
procedure Do_RPC(
Partition : in Partition_Id;
Params : access Params_Stream_Type;
Result : access Params_Stream_Type);
10-- Asynchronous call
procedure Do_APC(
Partition : in Partition_Id;
Params : access Params_Stream_Type);
11-- The handler for incoming RPCs
type RPC_Receiver is access procedure(
Params : access Params_Stream_Type;
Result : access Params_Stream_Type);
12procedure Establish_RPC_Receiver(
Partition : in Partition_Id;
Receiver : in RPC_Receiver);
13private
... -- not specified by the language
end System.RPC;
14A value of the type Partition_Id is used to identify a partition.
An object of the type Params_Stream_Type is used for identifying the particular remote subprogram that is being called, as well as marshalling and unmarshalling the parameters or result of a remote subprogram call, as part of sending them between partitions.
[The Read and Write procedures override the corresponding abstract operations for the type Params_Stream_Type.]
Dynamic Semantics
17The Do_RPC and Do_APC procedures send a message to the active partition identified by the Partition parameter.
After sending the message, Do_RPC blocks the calling task until a reply message comes back from the called partition or some error is detected by the underlying communication system in which case Communication_Error is raised at the point of the call to Do_RPC.
Do_APC operates in the same way as Do_RPC except that it is allowed to return immediately after sending the message.
Upon normal return, the stream designated by the Result parameter of Do_RPC contains the reply message.
The procedure System.RPC.Establish_RPC_Receiver is called once, immediately after elaborating the library units of an active partition (that is, right after the elaboration of the partition) if the partition includes an RCI library unit, but prior to invoking the main subprogram, if any. The Partition parameter is the Partition_Id of the active partition being elaborated. The Receiver parameter designates an implementation-provided procedure called the RPC-receiver which will handle all RPCs received by the partition from the PCS. Establish_RPC_Receiver saves a reference to the RPC-receiver; when a message is received at the called partition, the RPC-receiver is called with the Params stream containing the message. When the RPC-receiver returns, the contents of the stream designated by Result is placed in a message and sent back to the calling partition.
If a call on Do_RPC is aborted, a cancellation message is sent to the called partition, to request that the execution of the remotely called subprogram be aborted.
This paragraph was deleted.
Implementation Requirements
24The implementation of the RPC-receiver shall be reentrant[, thereby allowing concurrent calls on it from the PCS to service concurrent remote subprogram calls into the partition].
{8652/0087} An implementation shall not restrict the replacement of the body of System.RPC. An implementation shall not restrict children of System.RPC. [The related implementation permissions in the introduction to Annex A do not apply.]
{8652/0087} If the implementation of System.RPC is provided by the user, an implementation shall support remote subprogram calls as specified.
Documentation Requirements
25The implementation of the PCS shall document whether the RPC-receiver is invoked from concurrent tasks. If there is an upper limit on the number of such tasks, this limit shall be documented as well, together with the mechanisms to configure it (if this is supported).
Implementation Permissions
26The PCS is allowed to contain implementation-defined interfaces for explicit message passing, broadcasting, etc. Similarly, it is allowed to provide additional interfaces to query the state of some remote partition (given its partition ID) or of the PCS itself, to set timeouts and retry parameters, to get more detailed error status, etc. These additional interfaces should be provided in child packages of System.RPC.
A body for the package System.RPC is not required to be supplied by the implementation.
An alternative declaration is allowed for package System.RPC as long as it provides a set of operations that is substantially equivalent to the specification defined in this subclause.
Implementation Advice
28Whenever possible, the PCS on the called partition should allow for multiple tasks to call the RPC-receiver with different messages and should allow them to block until the corresponding subprogram body returns.
The Write operation on a stream of type Params_Stream_Type should raise Storage_Error if it runs out of space trying to write the Item into the stream.
allocator
it calls raises Storage_Error. This storage could be managed through a controlled component of the stream object, to ensure that it is reclaimed when the stream object is finalized.