| 1 |
@comment{ $Source: e:\\cvsroot/ARM/Source/ds.mss,v $ } |
| 2 |
@comment{ $Revision: 1.47 $ $Date: 2006/10/14 06:05:20 $ $Author: Randy $ } |
| 3 |
@Part(dist, Root="ada.mss") |
| 4 |
@Comment{$Date: 2006/10/14 06:05:20 $} |
| 5 |
|
| 6 |
@LabeledNormativeAnnex{Distributed Systems} |
| 7 |
|
| 8 |
@begin{Intro} |
| 9 |
@redundant[This Annex defines facilities for supporting the implementation |
| 10 |
of distributed systems using multiple partitions working |
| 11 |
cooperatively as part of a single Ada program.] |
| 12 |
@end{Intro} |
| 13 |
|
| 14 |
@begin{Extend83} |
| 15 |
@Defn{extensions to Ada 83} |
| 16 |
This Annex is new to Ada 95. |
| 17 |
@end{Extend83} |
| 18 |
|
| 19 |
@begin{LinkTime} |
| 20 |
|
| 21 |
@Defn{processing node} |
| 22 |
@Defn{storage node} |
| 23 |
@Defn{distributed system} |
| 24 |
A @i{distributed system} is an interconnection of one or more |
| 25 |
@i{processing nodes} (a system resource that has both computational |
| 26 |
and storage capabilities), and zero or more @i{storage nodes} |
| 27 |
(a system resource that has only storage capabilities, with the storage |
| 28 |
addressable by one or more processing nodes). |
| 29 |
|
| 30 |
@Defn{distributed program} |
| 31 |
A @i{distributed program} comprises one or more partitions that |
| 32 |
execute independently (except when they communicate) in a distributed system. |
| 33 |
|
| 34 |
@Defn2{Term=[configuration], Sec=(of the partitions of a program)} |
| 35 |
The process of mapping the partitions of a program |
| 36 |
to the nodes in a distributed system is |
| 37 |
called @i{configuring the partitions of the program}. |
| 38 |
@end{LinkTime} |
| 39 |
|
| 40 |
@begin{ImplReq} |
| 41 |
|
| 42 |
The implementation shall provide means for explicitly assigning library |
| 43 |
units to a partition and for the configuring and execution of a program |
| 44 |
consisting of multiple partitions on a distributed system; |
| 45 |
the means are implementation defined. |
| 46 |
@ImplDef{The means for creating and executing distributed programs.} |
| 47 |
|
| 48 |
@end{ImplReq} |
| 49 |
|
| 50 |
@begin{ImplPerm} |
| 51 |
|
| 52 |
An implementation may require that the set of processing nodes of |
| 53 |
a distributed system be homogeneous. |
| 54 |
|
| 55 |
@end{ImplPerm} |
| 56 |
|
| 57 |
@begin{Notes} |
| 58 |
|
| 59 |
|
| 60 |
The partitions comprising a program may be executed on differently |
| 61 |
configured distributed systems or on a non-distributed system without |
| 62 |
requiring recompilation. |
| 63 |
A distributed program may be partitioned differently from the same set of |
| 64 |
library units without recompilation. |
| 65 |
The resulting execution is semantically equivalent. |
| 66 |
|
| 67 |
A distributed program retains the same type safety |
| 68 |
as the equivalent single partition program. |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
@end{Notes} |
| 73 |
|
| 74 |
@LabeledClause{Partitions} |
| 75 |
|
| 76 |
@begin{Intro} |
| 77 |
@redundant[The partitions of a distributed program are classified as either |
| 78 |
active or passive.] |
| 79 |
@end{Intro} |
| 80 |
|
| 81 |
@begin{LinkTime} |
| 82 |
|
| 83 |
@Defn{active partition} |
| 84 |
@Defn{passive partition} |
| 85 |
An @i{active partition} is a partition as defined in |
| 86 |
@RefSecNum{Program Execution}. A @i{passive partition} is a partition |
| 87 |
that has no thread of control of its own, whose |
| 88 |
library units are all preelaborated, and whose data and subprograms are |
| 89 |
accessible to one or more active partitions. |
| 90 |
@begin{Discussion} |
| 91 |
In most situations, a passive partition does not execute, and does not have |
| 92 |
a @lquotes@;real@rquotes@; environment task. Any execution involved in |
| 93 |
its elaboration and initialization occurs before it comes into existence in a |
| 94 |
distributed program (like most preelaborated entities). Likewise, |
| 95 |
there is no concrete meaning to passive partition termination. |
| 96 |
@end{Discussion} |
| 97 |
|
| 98 |
A passive partition shall include only @nt{library_item}s that either are |
| 99 |
declared pure or are shared |
| 100 |
passive (see @RefSecNum{Elaboration Control} and |
| 101 |
@RefSecNum{Shared Passive Library Units}). |
| 102 |
|
| 103 |
An active partition shall be configured on a processing node. |
| 104 |
A passive partition shall be configured either on a storage node |
| 105 |
or on a processing node. |
| 106 |
|
| 107 |
The configuration of the partitions of a program onto a |
| 108 |
distributed system shall |
| 109 |
be consistent with the possibility for data references or calls |
| 110 |
between the partitions implied by their semantic dependences. |
| 111 |
@Defn{remote access} |
| 112 |
Any reference to data or call of |
| 113 |
a subprogram across partitions is called a @i{remote access}. |
| 114 |
@begin{Discussion} |
| 115 |
For example, an active partition that includes a unit with a semantic |
| 116 |
dependence on the declaration of another RCI package of some other active |
| 117 |
partition has to be connected to that other partition by some sort |
| 118 |
of a message passing mechanism. |
| 119 |
|
| 120 |
A passive partition that is accessible to an active partition should have |
| 121 |
its storage addressable to the processor(s) of the active partition. The |
| 122 |
processor(s) should be able to read and write from/to that |
| 123 |
storage, as well as |
| 124 |
to perform @lquotes@;read-modify-write@rquotes@; operations (in order to support entry-less |
| 125 |
protected objects). |
| 126 |
|
| 127 |
@end{Discussion} |
| 128 |
|
| 129 |
@end{LinkTime} |
| 130 |
|
| 131 |
@begin{RunTime} |
| 132 |
|
| 133 |
@Defn2{Term=[elaboration], Sec=(partition)} |
| 134 |
A @nt{library_item} is elaborated as part of the elaboration |
| 135 |
of each partition that includes it. |
| 136 |
If a normal library unit |
| 137 |
(see @RefSecNum{Categorization of Library Units}) has state, then a separate |
| 138 |
copy of the state exists in each active partition that elaborates it. |
| 139 |
@Redundant[The state evolves independently in each such partition.] |
| 140 |
|
| 141 |
|
| 142 |
@begin{Ramification} |
| 143 |
Normal library units cannot be included in passive partitions. |
| 144 |
@end{Ramification} |
| 145 |
|
| 146 |
@Defn2{Term=[termination], Sec=(of a partition)} |
| 147 |
@Defn2{Term=[abort], Sec=(of a partition)} |
| 148 |
@Defn{inaccessible partition} |
| 149 |
@Defn{accessible partition} |
| 150 |
@Redundant[An active partition @i{terminates} when its environment task |
| 151 |
terminates.] A partition becomes @i{inaccessible} if it terminates or if |
| 152 |
it is @i{aborted}. An active partition is aborted when its environment |
| 153 |
task is aborted. In addition, if a partition fails during its |
| 154 |
elaboration, it becomes inaccessible to other partitions. Other |
| 155 |
implementation-defined events can also result in a partition becoming |
| 156 |
inaccessible. |
| 157 |
@ImplDef{Any events that can result in a partition becoming |
| 158 |
inaccessible.} |
| 159 |
|
| 160 |
@ChgRef{Version=[1],Kind=[Revised]}@ChgNote{To be consistent with 8652/0006} |
| 161 |
@Leading@;For @ChgPrefixType{Version=[1],Kind=[Revised],Text=[a |
| 162 |
@Chg{New=[@nt{prefix}],Old=[prefix]} D that denotes a |
| 163 |
library-level declaration, |
| 164 |
excepting a declaration of or within a declared-pure library unit]}, |
| 165 |
the following attribute is defined: |
| 166 |
@begin{Description} |
| 167 |
@Attribute{Prefix=<D>, AttrName=<Partition_Id>, |
| 168 |
Text=[Denotes a value of the type @i{universal_integer} that |
| 169 |
identifies the partition in which D was elaborated. |
| 170 |
If D denotes the declaration of a remote call interface |
| 171 |
library unit |
| 172 |
(see @RefSecNum{Remote Call Interface Library Units}) the |
| 173 |
given partition is the one where the body of D was elaborated.]} |
| 174 |
@end{Description} |
| 175 |
|
| 176 |
@end{RunTime} |
| 177 |
|
| 178 |
@begin{Bounded} |
| 179 |
@PDefn2{Term=(bounded error),Sec=(cause)} |
| 180 |
It is a bounded error for there to be cyclic elaboration dependences |
| 181 |
between the active partitions of a single distributed |
| 182 |
program. |
| 183 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 184 |
The possible effects@Chg{Version=[2],New=[, in each of the partitions involved,],Old=[]} |
| 185 |
are deadlock during elaboration, or the raising of |
| 186 |
@Chg{Version=[2],New=[Communication_Error or ],Old=[]}Program_Error@Chg{Version=[2], |
| 187 |
New=[],Old=[ in one or all of the active partitions involved]}. |
| 188 |
@end{Bounded} |
| 189 |
|
| 190 |
@begin{ImplPerm} |
| 191 |
|
| 192 |
An implementation may allow multiple active or passive partitions |
| 193 |
to be configured on |
| 194 |
a single processing node, and multiple passive partitions to be |
| 195 |
configured on a single storage node. |
| 196 |
In these cases, the scheduling policies, treatment |
| 197 |
of priorities, and management of shared resources between |
| 198 |
these partitions are implementation defined. |
| 199 |
@ImplDef{The scheduling policies, treatment |
| 200 |
of priorities, and management of shared resources between |
| 201 |
partitions in certain cases.} |
| 202 |
|
| 203 |
An implementation may allow separate copies of an active partition to be |
| 204 |
configured on different processing nodes, and to provide |
| 205 |
appropriate interactions between the copies to present |
| 206 |
a consistent state of the partition to other active partitions. |
| 207 |
@begin{Ramification} |
| 208 |
The language does not specify the nature of these interactions, |
| 209 |
nor the actual level of consistency preserved. |
| 210 |
@end{Ramification} |
| 211 |
|
| 212 |
In an implementation, the partitions of a distributed |
| 213 |
program need not be loaded and elaborated all at the same time; |
| 214 |
they may be loaded and elaborated one at a time over an extended |
| 215 |
period of time. An implementation may provide facilities to abort |
| 216 |
and reload a partition during the execution of a distributed program. |
| 217 |
|
| 218 |
An implementation may allow the state of some of the partitions of |
| 219 |
a distributed program to persist while other partitions of the program |
| 220 |
terminate and are later reinvoked. |
| 221 |
@end{ImplPerm} |
| 222 |
|
| 223 |
@begin{Notes} |
| 224 |
|
| 225 |
Library units are grouped into partitions after compile time, |
| 226 |
but before run time. |
| 227 |
At compile time, only the relevant library unit properties are |
| 228 |
identified using categorization pragmas. |
| 229 |
|
| 230 |
|
| 231 |
The value returned by the Partition_Id attribute can be used as a |
| 232 |
parameter to implementation-provided subprograms in order |
| 233 |
to query information about the partition. |
| 234 |
|
| 235 |
@end{Notes} |
| 236 |
|
| 237 |
@begin{DiffWord95} |
| 238 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00226-01]} |
| 239 |
@ChgAdded{Version=[2],Text=[Corrected wording so that a partition that |
| 240 |
has an elaboration problem will either deadlock or raise an exception. |
| 241 |
While an Ada 95 implementation could allow some partitions to continue to |
| 242 |
execute, they could be accessing unelaborated data, which is very bad |
| 243 |
(and erroneous in a practical sense). Therefore, this isn't listed as an |
| 244 |
inconsistency.]} |
| 245 |
@end{DiffWord95} |
| 246 |
|
| 247 |
|
| 248 |
@LabeledClause{Categorization of Library Units} |
| 249 |
|
| 250 |
@begin{Intro} |
| 251 |
@redundant[Library units can be categorized according to the role |
| 252 |
they play in a distributed program. Certain restrictions |
| 253 |
are associated with each category to ensure that the semantics |
| 254 |
of a distributed program remain close to the semantics for a nondistributed |
| 255 |
program.] |
| 256 |
|
| 257 |
@RootDefn{categorization pragma} |
| 258 |
@RootDefn{pragma, categorization} |
| 259 |
@PDefn2{Term=[library unit pragma], Sec=(categorization pragmas)} |
| 260 |
@PDefn2{Term=[pragma, library unit], Sec=(categorization pragmas)} |
| 261 |
@Defn{categorized library unit} |
| 262 |
A @i{categorization pragma} is a library unit pragma |
| 263 |
(see @RefSecNum{Pragmas and Program Units}) |
| 264 |
that restricts the declarations, child units, or |
| 265 |
semantic dependences of the library unit to which it applies. A |
| 266 |
@i{categorized library unit} is a library unit to which |
| 267 |
a categorization pragma applies. |
| 268 |
|
| 269 |
The pragmas Shared_Passive, Remote_Types, and Remote_Call_Interface |
| 270 |
are categorization pragmas. |
| 271 |
In addition, for the purposes of this Annex, the pragma Pure |
| 272 |
(see @RefSecNum{Elaboration Control}) is |
| 273 |
considered a categorization pragma. |
| 274 |
|
| 275 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 276 |
@Defn{shared passive library unit} |
| 277 |
A library package or generic library package is called a |
| 278 |
@i{shared passive} library unit if a Shared_Passive pragma applies to it. |
| 279 |
@Defn{remote types library unit} |
| 280 |
A library package or generic library package is |
| 281 |
called a @i{remote types} library unit if a Remote_Types pragma applies to it. |
| 282 |
@Defn{remote call interface} |
| 283 |
A library @Chg{New=[unit],Old=[package or generic library package]} is called |
| 284 |
a @i{remote call interface} if a Remote_Call_Interface pragma applies to it. |
| 285 |
@Defn{normal library unit} |
| 286 |
A @i{normal library unit} is one to which no categorization pragma |
| 287 |
applies. |
| 288 |
@begin{Ramification} |
| 289 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 290 |
@ChgAdded{Version=[1],Text=[A library subprogram can be a remote call |
| 291 |
interface, but it cannot be a remote types or shared passive library unit.]} |
| 292 |
@end{Ramification} |
| 293 |
|
| 294 |
@redundant[The various categories of library units |
| 295 |
and the associated restrictions are |
| 296 |
described in this clause and its subclauses. |
| 297 |
The categories are related |
| 298 |
hierarchically in that the library units of one category can depend |
| 299 |
semantically only on library units of that category or an earlier one, |
| 300 |
except that the body of a remote types or remote call interface library |
| 301 |
unit is unrestricted. |
| 302 |
|
| 303 |
@Leading@;The overall hierarchy (including declared pure) is as follows: |
| 304 |
@begin{Description} |
| 305 |
Declared Pure @\Can depend only on other declared |
| 306 |
pure library units; |
| 307 |
|
| 308 |
Shared Passive @\Can depend only on other shared passive or |
| 309 |
declared pure library units; |
| 310 |
|
| 311 |
Remote Types @\The declaration of the library unit can depend only |
| 312 |
on other remote types library units, |
| 313 |
or one of the above; |
| 314 |
the body of the library unit is unrestricted; |
| 315 |
|
| 316 |
|
| 317 |
Remote Call Interface @\The declaration of the library unit can depend only |
| 318 |
on other remote call interfaces, or one of the above; |
| 319 |
the body of the library unit is unrestricted; |
| 320 |
|
| 321 |
Normal @\Unrestricted. |
| 322 |
@end{Description} |
| 323 |
|
| 324 |
Declared pure and shared passive library units are preelaborated. |
| 325 |
The declaration of a remote types or remote call interface library unit |
| 326 |
is required to be preelaborable. |
| 327 |
] |
| 328 |
|
| 329 |
@end{Intro} |
| 330 |
|
| 331 |
@begin{ImplReq} |
| 332 |
@ChgRef{Version=[1],Kind=[Deleted],Ref=[8652/0079],ARef=[AI95-00208-01]} |
| 333 |
@ChgDeleted{Version=[1],Text=[For a given library-level type declared in |
| 334 |
a preelaborated library unit or in the declaration of a remote types or remote |
| 335 |
call interface library unit, the implementation shall choose the same |
| 336 |
representation for the type upon each elaboration of the type's declaration for |
| 337 |
different partitions of the same program.]} |
| 338 |
@end{ImplReq} |
| 339 |
|
| 340 |
@begin{ImplPerm} |
| 341 |
|
| 342 |
Implementations are allowed to define other categorization pragmas. |
| 343 |
|
| 344 |
@end{ImplPerm} |
| 345 |
|
| 346 |
@begin{DiffWord95} |
| 347 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 348 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that a library |
| 349 |
subprogram can be a remote call interface unit.]} |
| 350 |
|
| 351 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0079],ARef=[AI95-00208-01]} |
| 352 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Removed the requirement that |
| 353 |
types be represented the same in all partitions, because it prevents the |
| 354 |
definition of heterogeneous distributed systems and goes much further than |
| 355 |
required.]} |
| 356 |
@end{DiffWord95} |
| 357 |
|
| 358 |
|
| 359 |
@LabeledSubClause{Shared Passive Library Units} |
| 360 |
@begin{Intro} |
| 361 |
@redundant[A shared passive library unit is used for managing global data |
| 362 |
shared between active partitions. The restrictions on shared passive |
| 363 |
library units prevent the data or tasks of one active partition |
| 364 |
from being accessible to another active partition through |
| 365 |
references implicit in objects declared in the shared passive library |
| 366 |
unit.] |
| 367 |
@end{Intro} |
| 368 |
|
| 369 |
@begin{MetaRules} |
| 370 |
The restrictions governing a shared |
| 371 |
passive library unit are |
| 372 |
designed to ensure that objects and |
| 373 |
subprograms declared in the package can be used safely from |
| 374 |
multiple active partitions, even though the active partitions |
| 375 |
live in different address spaces, and have separate run-time systems. |
| 376 |
@end{MetaRules} |
| 377 |
|
| 378 |
@begin{Syntax} |
| 379 |
@begin{SyntaxText} |
| 380 |
@Leading@PDefn2{Term=[categorization pragma], Sec=(Shared_Passive)} |
| 381 |
@PDefn2{Term=[pragma, categorization], Sec=(Shared_Passive)} |
| 382 |
The form of a @nt{pragma} Shared_Passive is as follows: |
| 383 |
@end{SyntaxText} |
| 384 |
|
| 385 |
@PragmaSyn`@key{pragma} @prag(Shared_Passive)[(@SynI{library_unit_}@Syn2{name})];' |
| 386 |
|
| 387 |
@end{Syntax} |
| 388 |
|
| 389 |
@begin{Legality} |
| 390 |
|
| 391 |
@Leading@Defn{shared passive library unit} |
| 392 |
A @i{shared passive library unit} is a library unit to which |
| 393 |
a Shared_Passive pragma applies. |
| 394 |
The following restrictions apply to such a library unit: |
| 395 |
@begin{itemize} |
| 396 |
@Redundant[it shall be preelaborable (see @RefSecNum{Elaboration Control});] |
| 397 |
@begin{Ramification} |
| 398 |
It cannot contain library-level declarations of protected objects |
| 399 |
with entries, nor of task objects. Task objects are disallowed |
| 400 |
because passive partitions don't have any threads of control of their |
| 401 |
own, nor any run-time system of their own. |
| 402 |
Protected objects with entries are disallowed because an entry queue |
| 403 |
contains references to calling tasks, and that would require in |
| 404 |
effect a pointer from a passive partition back to a task in |
| 405 |
some active partition. |
| 406 |
@end{Ramification} |
| 407 |
|
| 408 |
it shall depend semantically only upon |
| 409 |
declared pure or shared passive library units; |
| 410 |
@begin{reason} |
| 411 |
Shared passive packages cannot depend semantically upon remote types packages |
| 412 |
because the values of an access type declared in a remote types package |
| 413 |
refer to the local heap of the active partition including the |
| 414 |
remote types package. |
| 415 |
@end{reason} |
| 416 |
|
| 417 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0080],ARef=[AI95-00003-01]} |
| 418 |
it shall not contain a library-level declaration of an access type |
| 419 |
that designates a class-wide type, |
| 420 |
task type, or protected type with @nt{entry_declaration}s@Chg{New=[], |
| 421 |
Old=[; if the shared passive library unit is generic, it shall |
| 422 |
not contain a declaration for such an access type unless the |
| 423 |
declaration is nested within a body other than |
| 424 |
a @nt<package_body>]}. |
| 425 |
@begin{Reason} |
| 426 |
These kinds of access types are disallowed because the object |
| 427 |
designated by an access value of |
| 428 |
such a type could contain an implicit reference back to |
| 429 |
the active partition on whose behalf the designated object was |
| 430 |
created. |
| 431 |
@end{Reason} |
| 432 |
|
| 433 |
@end{itemize} |
| 434 |
|
| 435 |
@PDefn2{Term=[accessibility], Sec=(from shared passive library units)} |
| 436 |
@Defn{notwithstanding} |
| 437 |
Notwithstanding the definition of accessibility given in |
| 438 |
@RefSecNum(Operations of Access Types), the declaration |
| 439 |
of a library unit P1 is not accessible from within the declarative |
| 440 |
region of a shared passive library unit P2, |
| 441 |
unless the shared passive library unit |
| 442 |
P2 depends semantically on P1. |
| 443 |
@begin{Discussion} |
| 444 |
We considered a more complex rule, but dropped it. This is |
| 445 |
the simplest rule that recognizes that a shared passive |
| 446 |
package may outlive some other library package, unless it |
| 447 |
depends semantically on that package. In a nondistributed |
| 448 |
program, all library packages are presumed to have the same lifetime. |
| 449 |
|
| 450 |
Implementations may define additional pragmas that |
| 451 |
force two library packages to be in the same partition, or to have |
| 452 |
the same lifetime, which would allow this rule to be relaxed |
| 453 |
in the presence of such pragmas. |
| 454 |
@end{Discussion} |
| 455 |
|
| 456 |
@end{Legality} |
| 457 |
|
| 458 |
@begin{StaticSem} |
| 459 |
|
| 460 |
@PDefn{preelaborated} |
| 461 |
A shared passive library unit is |
| 462 |
preelaborated. |
| 463 |
|
| 464 |
@end{StaticSem} |
| 465 |
|
| 466 |
@begin{LinkTime} |
| 467 |
|
| 468 |
A shared passive library unit shall be |
| 469 |
assigned to at most one partition within a given program. |
| 470 |
|
| 471 |
@PDefn2{Term=[compilation units needed], Sec=(shared passive library unit)} |
| 472 |
@PDefn2{Term=[needed], Sec=(shared passive library unit)} |
| 473 |
@Defn{notwithstanding} |
| 474 |
Notwithstanding the rule given in @RefSecNum{Program Execution}, |
| 475 |
a compilation unit in a given partition |
| 476 |
does not @i{need} (in the |
| 477 |
sense of @RefSecNum{Program Execution}) |
| 478 |
the shared passive library units |
| 479 |
on which it depends semantically to be included in that same |
| 480 |
partition; they will typically reside in separate passive |
| 481 |
partitions. |
| 482 |
|
| 483 |
@end{LinkTime} |
| 484 |
|
| 485 |
@begin{DiffWord95} |
| 486 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0080],ARef=[AI95-00003-01]} |
| 487 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Corrected the wording to allow |
| 488 |
access types in blocks in shared passive generic packages.]} |
| 489 |
@end{DiffWord95} |
| 490 |
|
| 491 |
|
| 492 |
@LabeledSubClause{Remote Types Library Units} |
| 493 |
|
| 494 |
@begin{Intro} |
| 495 |
@redundant[A remote types library unit supports the definition of types |
| 496 |
intended for use in communication between active |
| 497 |
partitions.] |
| 498 |
@end{Intro} |
| 499 |
@begin{MetaRules} |
| 500 |
The restrictions governing a remote types package are similar to those for |
| 501 |
a declared pure package. However, the restrictions are relaxed |
| 502 |
deliberately to allow such a package to contain declarations that violate |
| 503 |
the stateless property of pure packages, though it is presumed |
| 504 |
that any state-dependent properties are essentially invisible |
| 505 |
outside the package. |
| 506 |
@end{MetaRules} |
| 507 |
|
| 508 |
@begin{Syntax} |
| 509 |
@begin{SyntaxText} |
| 510 |
@Leading@PDefn2{Term=[categorization pragma], Sec=(Remote_Types)} |
| 511 |
@PDefn2{Term=[pragma, categorization], Sec=(Remote_Types)} |
| 512 |
The form of a @nt{pragma} Remote_Types is as follows: |
| 513 |
@end{SyntaxText} |
| 514 |
|
| 515 |
@PragmaSyn`@key{pragma} @prag(Remote_Types)[(@SynI{library_unit_}@Syn2{name})];' |
| 516 |
|
| 517 |
@end{Syntax} |
| 518 |
|
| 519 |
@begin{Legality} |
| 520 |
|
| 521 |
@Leading@Defn{remote types library unit} |
| 522 |
A @i{remote types library unit} is a library unit to which the pragma |
| 523 |
Remote_Types applies. The following restrictions apply to |
| 524 |
the declaration of such a library unit: |
| 525 |
@begin{itemize} |
| 526 |
@Redundant[it shall be preelaborable;] |
| 527 |
|
| 528 |
it shall depend semantically only on declared pure, shared passive, |
| 529 |
or other remote types library units; |
| 530 |
|
| 531 |
it shall not contain the declaration of any variable |
| 532 |
within the visible part of the library unit; |
| 533 |
@begin{Reason} |
| 534 |
This is essentially a @lquotes@;methodological@rquotes@; restriction. |
| 535 |
A separate copy of a remote types package is included |
| 536 |
in each partition that references it, just like a normal package. |
| 537 |
Nevertheless, a remote types package is thought of as |
| 538 |
an @lquotes@;essentially pure@rquotes@; package for defining types to be used |
| 539 |
for interpartition communication, |
| 540 |
and it could be misleading to declare visible objects |
| 541 |
when no remote data access is actually being provided. |
| 542 |
@end{Reason} |
| 543 |
|
| 544 |
|
| 545 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 546 |
@Chg{Version=[2],New=[],Old=[if ]}the full view of @Chg{Version=[2],New=[each],Old=[a]} |
| 547 |
type declared in the visible part of the |
| 548 |
library unit @Chg{Version=[2],New=[that has any available stream attributes |
| 549 |
shall support external streaming (see |
| 550 |
@RefSecNum{Stream-Oriented Attributes})], Old=[has a part that is of a |
| 551 |
non-remote access type, then that access type, or the type of some |
| 552 |
part that includes the access type subcomponent, |
| 553 |
shall have user-specified Read and Write attributes]}. |
| 554 |
@begin{Reason} |
| 555 |
This is to prevent the use of the predefined Read and Write |
| 556 |
attributes of an access type as part of the Read and Write |
| 557 |
attributes of a visible type. |
| 558 |
@end{Reason} |
| 559 |
@begin{Ramification} |
| 560 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 561 |
@ChgAdded{Version=[2],Text=[Types that do not have available stream |
| 562 |
attributes are excluded from this rule; that means that attributes do not |
| 563 |
need to be specified for most limited types. It is only necessary to specify |
| 564 |
attributes for nonlimited types that have a part that is of any access type, |
| 565 |
and for extensions of limited types with available stream attributes where |
| 566 |
the @nt{record_extension_part} includes a subcomponent of an access type, |
| 567 |
where the access type does not have specified attributes.]} |
| 568 |
@end{Ramification} |
| 569 |
@end{itemize} |
| 570 |
|
| 571 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 572 |
@Chg{New=[@Leading],Old=[]}@Defn{remote access type} |
| 573 |
An access type declared in the visible part of a remote types or remote |
| 574 |
call interface library unit is called a @i{remote access type}. |
| 575 |
@Defn{remote access-to-subprogram type} |
| 576 |
@Defn{remote access-to-class-wide type} |
| 577 |
Such a type shall be@Chg{New=[:],Old=[ either an access-to-subprogram type |
| 578 |
or a general access type that designates a class-wide limited private |
| 579 |
type.]} |
| 580 |
|
| 581 |
@begin{Itemize} |
| 582 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 583 |
@ChgAdded{Version=[1],Text=[an access-to-subprogram type, or]} |
| 584 |
|
| 585 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 586 |
@ChgAdded{Version=[1],Text=[a general access type that designates a class-wide |
| 587 |
limited private type or a class-wide private type extension all of whose |
| 588 |
ancestors are either private type extensions or limited private types.]} |
| 589 |
@end{Itemize} |
| 590 |
|
| 591 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0081],ARef=[AI95-00004-01]} |
| 592 |
@ChgAdded{Version=[1],Text=[A type that is derived from a remote access type |
| 593 |
is also a remote access type.]} |
| 594 |
|
| 595 |
@Leading@;The following restrictions apply to the use of a |
| 596 |
remote access-to-subprogram type: |
| 597 |
@begin{Itemize} |
| 598 |
|
| 599 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00431-01]} |
| 600 |
A value of a remote access-to-subprogram type |
| 601 |
shall be converted only to @Chg{Version=[2],New=[or from ],Old=[]}another |
| 602 |
(subtype-conformant) remote access-to-subprogram type; |
| 603 |
|
| 604 |
The @nt<prefix> of an Access @nt<attribute_reference> that yields |
| 605 |
a value of a remote access-to-subprogram type shall statically denote a |
| 606 |
(subtype-conformant) remote subprogram. |
| 607 |
@end{Itemize} |
| 608 |
|
| 609 |
@Leading@;The following restrictions apply to the use of a |
| 610 |
remote access-to-class-wide type: |
| 611 |
@begin{Itemize} |
| 612 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0083],ARef=[AI95-00047-01]} |
| 613 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 614 |
The primitive subprograms of the corresponding specific limited private type |
| 615 |
shall only have access parameters if they are controlling formal parameters; |
| 616 |
@Chg{New=[each non-controlling formal parameter],Old=[the types of all the |
| 617 |
non-controlling formal parameters]} shall @Chg{Version=[2],New=[support |
| 618 |
external streaming (see @RefSecNum{Stream-Oriented Attributes});], |
| 619 |
Old=[have @Chg{New=[either a nonlimited |
| 620 |
type or a type with],Old=[]} Read and Write attributes@Chg{New=[ specified |
| 621 |
via an @nt{attribute_definition_clause};],Old=[.]}]} |
| 622 |
|
| 623 |
A value of a remote access-to-class-wide type shall be |
| 624 |
explicitly converted only to another remote access-to-class-wide type; |
| 625 |
|
| 626 |
@ChgRef{Version=[1],Kind=[Revised]} |
| 627 |
A value of a remote access-to-class-wide type shall be dereferenced |
| 628 |
(or implicitly converted to an anonymous access type) |
| 629 |
only as part of a dispatching call where the value designates |
| 630 |
a controlling operand of the call (see @RefSec{Remote Subprogram Calls})@Chg{New=[.],Old=[;]} |
| 631 |
|
| 632 |
@ChgRef{Version=[1],Kind=[Revised]} |
| 633 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00366-01]} |
| 634 |
The Storage_Pool @Chg{Version=[2],New=[attribute is],Old=[and |
| 635 |
Storage_Size attributes are]} not defined for@Chg{Version=[2],New=[ a],Old=[]} |
| 636 |
remote access-to-class-wide @Chg{Version=[2],New=[type],Old=[types]}; |
| 637 |
the expected type for an @nt{allocator} shall not be a remote |
| 638 |
access-to-class-wide type@Chg{Version=[2],New=[. A],Old=[; a]} remote |
| 639 |
access-to-class-wide type shall not be an actual parameter for a generic |
| 640 |
formal access type@Chg{New=[.],Old=[;]}@Chg{Version=[2],New=[ The Storage_Size |
| 641 |
attribute of a remote access-to-class-wide type yields 0; it is not allowed in |
| 642 |
an @nt{attribute_definition_clause}.],Old=[]} |
| 643 |
@begin{Reason} |
| 644 |
@ChgRef{Version=[2],Kind=[Revised]} |
| 645 |
All three of these restrictions are because |
| 646 |
there is no storage pool associated with a remote |
| 647 |
access-to-class-wide type.@Chg{Version=[2],New=[ The Storage_Size is defined |
| 648 |
to be 0 so that there is no conflict with the rules for pure units.],Old=[]} |
| 649 |
@end{Reason} |
| 650 |
@end{Itemize} |
| 651 |
|
| 652 |
@end{Legality} |
| 653 |
|
| 654 |
@begin{Notes} |
| 655 |
A remote types library unit |
| 656 |
need not be pure, and the types it defines may |
| 657 |
include levels of indirection implemented by using access types. |
| 658 |
User-specified Read and Write attributes |
| 659 |
(see @RefSecNum{Stream-Oriented Attributes}) |
| 660 |
provide for sending values of such a type |
| 661 |
between active partitions, with Write marshalling the |
| 662 |
representation, and Read unmarshalling any levels of |
| 663 |
indirection. |
| 664 |
@end{Notes} |
| 665 |
|
| 666 |
@begin{Incompatible95} |
| 667 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00240-01]} |
| 668 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 669 |
@b[Amendment Correction:] The wording was changed from |
| 670 |
@lquotes@;user-specified@rquotes to @lquotes@;available@rquotes |
| 671 |
attributes. (This was then further changed, see below.) This means that |
| 672 |
an access type with the attributes specified in the private part would |
| 673 |
originally have been sufficient to allow the access type to be used in |
| 674 |
a remote type, but that is no longer allowed. Similarly, the attributes |
| 675 |
of a remote type that has access components have to be specified in the |
| 676 |
visible part. These changes were made so that the rules were consistent with |
| 677 |
the rules introduced for the Corrigendum for stream attributes; moreover, |
| 678 |
legality should not depend on the contents of the private part.]} |
| 679 |
@end{Incompatible95} |
| 680 |
|
| 681 |
@begin{Extend95} |
| 682 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 683 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 684 |
Remote types that cannot be streamed (that is, have no available stream |
| 685 |
attributes) do not require the specification of stream attributes. |
| 686 |
This is necessary so that most extensions of Limited_Controlled do not |
| 687 |
need stream attributes defined (otherwise there would be a signficant |
| 688 |
incompatibility, as Limited_Controlled would need stream attributes, and then |
| 689 |
all extensions of it also would need stream attributes).]} |
| 690 |
@end{Extend95} |
| 691 |
|
| 692 |
@begin{DiffWord95} |
| 693 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0081],ARef=[AI95-00004-01]} |
| 694 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Added missing wording so that |
| 695 |
a type derived from a remote access type is also a remote access type.]} |
| 696 |
|
| 697 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0083],ARef=[AI95-00047-01]} |
| 698 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that user-defined |
| 699 |
Read and Write attributes are required for the primitive subprograms |
| 700 |
corresponding to a remote access-to-class-wide type.]} |
| 701 |
|
| 702 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0082],ARef=[AI95-00164-01]} |
| 703 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Added missing wording so that |
| 704 |
a remote access type can designate an appropriate private extension.]} |
| 705 |
|
| 706 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 707 |
@ChgAdded{Version=[2],Text=[Changed the wording to use the newly defined |
| 708 |
term @i<type that supports external streaming>, so that various issues |
| 709 |
with access types in pure units and implicitly declared attributes for |
| 710 |
type extensions are properly handled.]} |
| 711 |
|
| 712 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 713 |
@ChgAdded{Version=[2],Text=[Defined Storage_Size to be 0 for |
| 714 |
remote access-to-class-wide types, rather than having it undefined. This |
| 715 |
eliminates issues with pure units requiring a defined storage size.]} |
| 716 |
|
| 717 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00431-01]} |
| 718 |
@ChgAdded{Version=[2],Text=[Corrected the wording so that a value of a local |
| 719 |
access-to-subprogram type cannot be converted to a remote |
| 720 |
access-to-subprogram type, as intended (and required by the ACATS).]} |
| 721 |
@end{DiffWord95} |
| 722 |
|
| 723 |
|
| 724 |
@LabeledSubClause{Remote Call Interface Library Units} |
| 725 |
|
| 726 |
@begin{Intro} |
| 727 |
@redundant[A remote call interface library unit can be |
| 728 |
used as an interface for remote procedure calls (RPCs) (or remote |
| 729 |
function calls) between active partitions.] |
| 730 |
@end{Intro} |
| 731 |
|
| 732 |
@begin{MetaRules} |
| 733 |
The restrictions governing a remote call |
| 734 |
interface library unit are intended to ensure that |
| 735 |
the values of the actual parameters in a remote call can be meaningfully |
| 736 |
sent between two active partitions. |
| 737 |
@end{MetaRules} |
| 738 |
|
| 739 |
@begin{Syntax} |
| 740 |
@begin{SyntaxText} |
| 741 |
@Leading@PDefn2{Term=[categorization pragma], Sec=(Remote_Call_Interface)} |
| 742 |
@PDefn2{Term=[pragma, categorization], Sec=(Remote_Call_Interface)} |
| 743 |
The form of a @nt{pragma} Remote_Call_Interface is as follows: |
| 744 |
@end{SyntaxText} |
| 745 |
|
| 746 |
@PragmaSyn`@key{pragma} @prag(Remote_Call_Interface)[(@SynI{library_unit_}@Syn2{name})];' |
| 747 |
|
| 748 |
@begin{SyntaxText} |
| 749 |
@Leading@;The form of a @nt{pragma} All_Calls_Remote is as follows: |
| 750 |
@end{SyntaxText} |
| 751 |
|
| 752 |
@PragmaSyn`@key{pragma} @prag(All_Calls_Remote)[(@SynI{library_unit_}@Syn2{name})];' |
| 753 |
|
| 754 |
@begin{SyntaxText} |
| 755 |
@PDefn2{Term=[library unit pragma], Sec=(All_Calls_Remote)} |
| 756 |
@PDefn2{Term=[pragma, library unit], Sec=(All_Calls_Remote)} |
| 757 |
A @nt{pragma} All_Calls_Remote is a library unit pragma. |
| 758 |
@end{SyntaxText} |
| 759 |
|
| 760 |
@end{Syntax} |
| 761 |
|
| 762 |
@begin{Legality} |
| 763 |
|
| 764 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 765 |
@Defn{remote call interface} |
| 766 |
@Defn2{Term=[RCI],Sec=(library unit)} |
| 767 |
@Defn2{Term=[RCI],Sec=(package)} |
| 768 |
@Defn2{Term=[RCI],Sec=(generic)} |
| 769 |
@Defn{remote subprogram} |
| 770 |
A @i{remote call interface (RCI)} is a library unit to which the |
| 771 |
pragma Remote_Call_Interface applies. |
| 772 |
A subprogram declared in the visible part of such a library unit@Chg{New=[, |
| 773 |
or declared by such a library unit,],Old=[]} is called a @i{remote subprogram}. |
| 774 |
|
| 775 |
The declaration of an RCI library unit shall be preelaborable |
| 776 |
(see @RefSecNum{Elaboration Control}), and shall depend semantically |
| 777 |
only upon declared pure, shared passive, |
| 778 |
remote types, or other remote call interface library units. |
| 779 |
|
| 780 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 781 |
@Leading@;In addition, the following restrictions apply to @Chg{New=[],Old=[the |
| 782 |
visible part of ]}an RCI library unit: |
| 783 |
@begin{itemize} |
| 784 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 785 |
it@Chg{New=[s visible part],Old=[]} shall not contain the declaration of a |
| 786 |
variable; |
| 787 |
@begin{Reason} |
| 788 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 789 |
Remote call interface @Chg{New=[units],Old=[packages]} do not provide remote |
| 790 |
data access. A shared passive package has to be used for that. |
| 791 |
@end{Reason} |
| 792 |
|
| 793 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 794 |
it@Chg{New=[s visible part],Old=[]} shall not contain the declaration of a |
| 795 |
limited type; |
| 796 |
@begin{Reason} |
| 797 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 798 |
We disallow the declaration of task and protected types, |
| 799 |
since calling an entry or a protected subprogram implicitly passes |
| 800 |
an object of a limited type (the target task or protected object). |
| 801 |
We disallow other limited types since we require that such types |
| 802 |
have @Chg{Version=[2],New=[available],Old=[user-defined]} Read and Write |
| 803 |
attributes, but we certainly |
| 804 |
don't want the Read and Write attributes themselves to involve remote |
| 805 |
calls (thereby defeating their purpose of marshalling the |
| 806 |
value for remote calls). |
| 807 |
@end{Reason} |
| 808 |
|
| 809 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 810 |
it@Chg{New=[s visible part],Old=[]} shall not contain a nested |
| 811 |
@nt{generic_declaration}; |
| 812 |
@begin{Reason} |
| 813 |
This is disallowed because the body of the nested generic |
| 814 |
would presumably have access to data inside the body of the |
| 815 |
RCI package, and if instantiated in a different partition, remote |
| 816 |
data access might result, which is not supported. |
| 817 |
@end{Reason} |
| 818 |
|
| 819 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 820 |
it shall not @Chg{New=[be, nor shall its visible part],Old=[]} contain@Chg{New=[,],Old=[]} the |
| 821 |
declaration of a subprogram to which a pragma Inline applies; |
| 822 |
|
| 823 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 824 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00240-01],ARef=[AI95-00366-01]} |
| 825 |
it shall not @Chg{New=[be, nor shall its visible part], |
| 826 |
Old=[]} contain@Chg{New=[,],Old=[]} a |
| 827 |
subprogram (or access-to-subprogram) declaration |
| 828 |
whose profile has @Chg{Version=[2],New=[@Redundant[an access parameter or] |
| 829 |
a parameter of a type that does not support external streaming |
| 830 |
(see @RefSecNum{Stream-Oriented Attributes})], |
| 831 |
Old=[an access parameter, or a formal parameter of a |
| 832 |
limited type unless that limited type has user-specified Read and Write |
| 833 |
attributes]}; |
| 834 |
|
| 835 |
any public child of the library unit shall |
| 836 |
be a remote call interface library unit. |
| 837 |
@begin{Reason} |
| 838 |
No restrictions apply to the private part of an RCI package, |
| 839 |
and since a public child can @lquotes@;see@rquotes@; the private part |
| 840 |
of its parent, such a child must itself have a |
| 841 |
Remote_Call_Interface pragma, and be assigned to the same partition |
| 842 |
(see below). |
| 843 |
@end{Reason} |
| 844 |
@begin{Discussion} |
| 845 |
We considered making the public child of an RCI package |
| 846 |
implicitly RCI, but it seemed better to require an explicit |
| 847 |
pragma to avoid any confusion. |
| 848 |
|
| 849 |
Note that there is no need for a private child to be an RCI package, |
| 850 |
since it can only be seen from the body of its parent |
| 851 |
or its siblings, all of which are required to be in the |
| 852 |
same active partition. |
| 853 |
@end{Discussion} |
| 854 |
@end{itemize} |
| 855 |
|
| 856 |
If a pragma All_Calls_Remote applies to a library unit, |
| 857 |
the library unit shall be a remote call interface. |
| 858 |
@end{Legality} |
| 859 |
|
| 860 |
@begin{LinkTime} |
| 861 |
|
| 862 |
A remote call interface library unit shall be |
| 863 |
assigned to at most one partition of a given program. |
| 864 |
A remote call |
| 865 |
interface library unit whose parent is also an RCI library unit |
| 866 |
shall be |
| 867 |
assigned only to the same partition as its parent. |
| 868 |
@begin{ImplNote} |
| 869 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 870 |
The declaration of an RCI @Chg{New=[unit],Old=[package]}, with a calling-stub |
| 871 |
body, is automatically included in all active |
| 872 |
partitions with compilation units that depend on it. |
| 873 |
However the whole RCI library unit, including its |
| 874 |
(non-stub) body, will only be in one of the active partitions. |
| 875 |
@end{ImplNote} |
| 876 |
|
| 877 |
@PDefn2{Term=[compilation units needed], Sec=(remote call interface)} |
| 878 |
@PDefn2{Term=[needed], Sec=(remote call interface)} |
| 879 |
@Defn{notwithstanding} |
| 880 |
Notwithstanding the rule given in @RefSecNum{Program Execution}, |
| 881 |
a compilation unit in a given partition that semantically depends on |
| 882 |
the declaration of an RCI library unit, |
| 883 |
@i{needs} (in the sense of @RefSecNum{Program Execution}) |
| 884 |
only the declaration of the |
| 885 |
RCI library unit, not the body, to be included in that same partition. |
| 886 |
@Redundant[Therefore, the body of an RCI library unit is included |
| 887 |
only in the partition to which the RCI library unit is |
| 888 |
explicitly assigned.] |
| 889 |
|
| 890 |
@end{LinkTime} |
| 891 |
|
| 892 |
@begin{ImplReq} |
| 893 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 894 |
If a pragma All_Calls_Remote applies to a |
| 895 |
given RCI library @Chg{New=[unit],Old=[package]}, then the |
| 896 |
implementation shall route any call to a subprogram of the RCI |
| 897 |
@Chg{New=[unit],Old=[package]} from outside the declarative region of the |
| 898 |
@Chg{New=[unit],Old=[package]} through the Partition Communication Subsystem |
| 899 |
(PCS); see @RefSecNum{Partition Communication Subsystem}. |
| 900 |
Calls to such subprograms from within the declarative region of |
| 901 |
the @Chg{New=[unit],Old=[package]} are defined to be local and shall |
| 902 |
not go through the PCS. |
| 903 |
@begin{Discussion} |
| 904 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 905 |
Without this pragma, it is presumed that most implementations will |
| 906 |
make direct calls if the call originates in the same partition |
| 907 |
as that of the RCI @Chg{New=[unit],Old=[package]}. With this pragma, all calls |
| 908 |
from outside the subsystem rooted at the RCI @Chg{New=[unit],Old=[package]} are |
| 909 |
treated like calls from outside the |
| 910 |
partition, ensuring that the PCS is involved in all such calls |
| 911 |
(for debugging, redundancy, etc.). |
| 912 |
@end{Discussion} |
| 913 |
@begin{reason} |
| 914 |
There is no point to force local calls (or calls from children) to go through |
| 915 |
the PCS, since on the target system, these calls are always local, |
| 916 |
and all the units are in the same active partition. |
| 917 |
@end{Reason} |
| 918 |
@end{ImplReq} |
| 919 |
|
| 920 |
@begin{ImplPerm} |
| 921 |
|
| 922 |
An implementation need not support the |
| 923 |
Remote_Call_Interface pragma nor the All_Calls_Remote pragma. |
| 924 |
@Redundant[Explicit message-based communication between active partitions can |
| 925 |
be supported as an alternative to RPC.] |
| 926 |
@begin{Ramification} |
| 927 |
Of course, it is pointless to support the All_Calls_Remote |
| 928 |
pragma if the Remote_Call_Interface pragma (or some |
| 929 |
approximate equivalent) is not supported. |
| 930 |
@end{Ramification} |
| 931 |
|
| 932 |
@end{ImplPerm} |
| 933 |
|
| 934 |
@begin{Incompatible95} |
| 935 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00240-01]} |
| 936 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 937 |
@b[Amendment Correction:] The wording was changed from |
| 938 |
@lquotes@;user-specified@rquotes to @lquotes@;available@rquotes |
| 939 |
attributes. (This was then further changed, see below.) This means that |
| 940 |
a type with the attributes specified in the private part would |
| 941 |
originally have been allowed as a formal parameter of an RCI subprogram, |
| 942 |
but that is no longer allowed. |
| 943 |
This change was made so that the rules were consistent with the rules |
| 944 |
introduced for the Corrigendum for stream attributes; moreover, legality |
| 945 |
should not depend on the contents of the private part.]} |
| 946 |
@end{Incompatible95} |
| 947 |
|
| 948 |
@begin{DiffWord95} |
| 949 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0078],ARef=[AI95-00048-01]} |
| 950 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Changed the wording to allow |
| 951 |
a library subprogram to be a remote call interface unit.]} |
| 952 |
|
| 953 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00366-01]} |
| 954 |
@ChgAdded{Version=[2],Text=[Changed the wording to use the newly defined |
| 955 |
term @i<type that supports external streaming>, so that various issues |
| 956 |
with access types in pure units and implicitly declared attributes for |
| 957 |
type extensions are properly handled.]} |
| 958 |
@end{DiffWord95} |
| 959 |
|
| 960 |
|
| 961 |
@LabeledClause{Consistency of a Distributed System} |
| 962 |
|
| 963 |
@begin{Intro} |
| 964 |
@redundant[This clause defines attributes and rules associated with verifying |
| 965 |
the consistency of a distributed program. |
| 966 |
] |
| 967 |
@end{Intro} |
| 968 |
|
| 969 |
@begin{MetaRules} |
| 970 |
|
| 971 |
The rules guarantee that remote call interface |
| 972 |
and shared passive packages are consistent among all partitions |
| 973 |
prior to the execution of a distributed program, so |
| 974 |
that the semantics of the distributed program are well defined. |
| 975 |
|
| 976 |
@end{MetaRules} |
| 977 |
|
| 978 |
@begin{StaticSem} |
| 979 |
|
| 980 |
@ChgRef{Version=[1],Kind=[Revised]}@ChgNote{To be consistent with 8652/0006} |
| 981 |
@Leading@;For @ChgPrefixType{Version=[1],Kind=[Revised],Text=[a |
| 982 |
@Chg{New=[@nt{prefix}],Old=[prefix]} P that statically denotes a |
| 983 |
program unit]}, the following attributes are defined: |
| 984 |
@begin{Description} |
| 985 |
@Attribute{Prefix=<P>, AttrName=<Version>, |
| 986 |
Text=[Yields a value of the predefined type String |
| 987 |
that identifies the version of the compilation unit that |
| 988 |
contains the declaration of the program unit.]} |
| 989 |
|
| 990 |
@Attribute{Prefix=<P>, AttrName=<Body_Version>, |
| 991 |
Text=[Yields a value of the predefined type String |
| 992 |
that identifies the version of the compilation unit that contains |
| 993 |
the body (but not any subunits) of the program unit.]} |
| 994 |
@end{Description} |
| 995 |
@EndPrefixType{} |
| 996 |
|
| 997 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0084],ARef=[AI95-00104-01]} |
| 998 |
@Defn2{Term=[version], Sec=(of a compilation unit)} |
| 999 |
The @i{version} of a compilation unit changes whenever the |
| 1000 |
@Chg{New=[],Old=[version changes for any ]}compilation unit |
| 1001 |
@Chg{New=[changes in a semantically significant way. This International |
| 1002 |
Standard does not define the exact meaning of "semantically significant"], |
| 1003 |
Old=[on which it depends semantically. The version also changes whenever the |
| 1004 |
compilation unit itself changes in a semantically significant way]}. |
| 1005 |
It is @Chg{New=[unspecified],Old=[implementation defined]} |
| 1006 |
whether there are other events (such as recompilation) that |
| 1007 |
result in the version of a compilation unit changing. |
| 1008 |
@Chg{New=[@PDefn{unspecified}],Old=[]} |
| 1009 |
@ChgImplDef{Version=[1],Kind=[Deleted],Text=[@Chg{New=[],Old=[Events that |
| 1010 |
cause the version of a compilation unit to change.]}]} |
| 1011 |
|
| 1012 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0084],ARef=[AI95-00104-01]} |
| 1013 |
@ChgAdded{Version=[1],Text=[If P is not a library unit, and P has no completion, |
| 1014 |
then P'Body_Version returns the Body_Version of the innermost program unit |
| 1015 |
enclosing the declaration of P. If P is a library unit, and P has no |
| 1016 |
completion, then P'Body_Version returns a value that is different from |
| 1017 |
Body_Version of any version of P that has a completion.]} |
| 1018 |
@end{StaticSem} |
| 1019 |
|
| 1020 |
@begin{Bounded} |
| 1021 |
@PDefn2{Term=(bounded error),Sec=(cause)} |
| 1022 |
@Defn{unit consistency} |
| 1023 |
In a distributed program, a library unit is @i{consistent} if the same |
| 1024 |
version of its declaration is used throughout. |
| 1025 |
It is a bounded error to elaborate a partition of a distributed |
| 1026 |
program that contains a compilation unit that depends on a different |
| 1027 |
version of the declaration of a shared passive or RCI library |
| 1028 |
unit than |
| 1029 |
that included in the partition to which the shared passive or |
| 1030 |
RCI library unit |
| 1031 |
was assigned. |
| 1032 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 1033 |
As a result of this error, Program_Error |
| 1034 |
can be raised in one or both partitions during elaboration; |
| 1035 |
in any case, the partitions |
| 1036 |
become inaccessible to one another. |
| 1037 |
@begin{Ramification} |
| 1038 |
Because a version changes if anything on which it depends undergoes |
| 1039 |
a version change, requiring consistency for shared passive |
| 1040 |
and remote call interface library units is |
| 1041 |
sufficient to ensure |
| 1042 |
consistency for the declared pure and remote types library |
| 1043 |
units that |
| 1044 |
define the types used for the objects and parameters |
| 1045 |
through which interpartition communication takes place. |
| 1046 |
|
| 1047 |
Note that we do not require matching Body_Versions; it is |
| 1048 |
irrelevant for shared passive and remote call interface |
| 1049 |
packages, since only one copy of their body exists in a |
| 1050 |
distributed program (in the absence of implicit replication), |
| 1051 |
and we allow the bodies to differ for declared pure and |
| 1052 |
remote types packages from partition to partition, presuming |
| 1053 |
that the differences are due to required error corrections |
| 1054 |
that took place during the execution of a long-running distributed |
| 1055 |
program. The Body_Version attribute provides a means |
| 1056 |
for performing stricter consistency checks. |
| 1057 |
@end{Ramification} |
| 1058 |
@end{Bounded} |
| 1059 |
|
| 1060 |
@begin{DiffWord95} |
| 1061 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0084],ARef=[AI95-00104-01]} |
| 1062 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified the meaning of |
| 1063 |
'Version and 'Body_Version.]} |
| 1064 |
@end{DiffWord95} |
| 1065 |
|
| 1066 |
|
| 1067 |
@LabeledClause{Remote Subprogram Calls} |
| 1068 |
|
| 1069 |
@begin{Intro} |
| 1070 |
@Defn{remote subprogram call} |
| 1071 |
@RootDefn{asynchronous remote procedure call} |
| 1072 |
@Defn{calling partition} |
| 1073 |
@Defn{called partition} |
| 1074 |
@Defn{remote subprogram binding} |
| 1075 |
A @i{remote subprogram call} is a subprogram call that invokes the |
| 1076 |
execution of a subprogram in another partition. |
| 1077 |
The partition that |
| 1078 |
originates the remote subprogram call is the @i{calling partition}, and the |
| 1079 |
partition that executes the corresponding subprogram body is the @i{called |
| 1080 |
partition}. |
| 1081 |
Some remote procedure calls are allowed to return prior to the completion of |
| 1082 |
subprogram execution. These are called @i{asynchronous remote procedure |
| 1083 |
calls}. |
| 1084 |
|
| 1085 |
@Leading@;There are three different ways of performing a remote subprogram call: |
| 1086 |
@begin{Itemize} |
| 1087 |
As a direct call on a (remote) subprogram explicitly declared in a |
| 1088 |
remote call interface; |
| 1089 |
|
| 1090 |
As an indirect call through a value of a remote access-to-subprogram type; |
| 1091 |
|
| 1092 |
As a dispatching call with a controlling operand designated by |
| 1093 |
a value of a remote access-to-class-wide type. |
| 1094 |
@end{Itemize} |
| 1095 |
|
| 1096 |
The first way of calling corresponds to a @i(static) binding between |
| 1097 |
the calling and the called partition. |
| 1098 |
The latter two ways correspond to a @i(dynamic) binding between |
| 1099 |
the calling and the called partition. |
| 1100 |
|
| 1101 |
A remote call interface library unit |
| 1102 |
(see @RefSecNum{Remote Call Interface Library Units}) |
| 1103 |
defines the remote subprograms or remote access types used for |
| 1104 |
remote subprogram calls. |
| 1105 |
@end{Intro} |
| 1106 |
|
| 1107 |
@begin{MetaRules} |
| 1108 |
|
| 1109 |
Remote subprogram calls are standardized since the RPC paradigm is |
| 1110 |
widely-used, and establishing an interface to it in the annex will |
| 1111 |
increase the portability and reusability of distributed |
| 1112 |
programs. |
| 1113 |
|
| 1114 |
@end{MetaRules} |
| 1115 |
|
| 1116 |
@begin{Legality} |
| 1117 |
In a dispatching call with two or more controlling operands, |
| 1118 |
if one controlling operand is designated by a value of a |
| 1119 |
remote access-to-class-wide type, then all shall be. |
| 1120 |
@end{Legality} |
| 1121 |
|
| 1122 |
@begin{RunTime} |
| 1123 |
|
| 1124 |
@Defn{marshalling} |
| 1125 |
@Defn{unmarshalling} |
| 1126 |
@PDefn2{Term=[execution], Sec=(remote subprogram call)} |
| 1127 |
For the execution of a remote subprogram call, subprogram parameters |
| 1128 |
(and later the results, if any) are passed using a stream-oriented |
| 1129 |
representation |
| 1130 |
(see @RefSecNum{The Package Streams}) @Redundant[which is |
| 1131 |
suitable for transmission between partitions]. This action is called |
| 1132 |
@i{marshalling}. @i{Unmarshalling} is the reverse action of |
| 1133 |
reconstructing the parameters or results from the stream-oriented |
| 1134 |
representation. |
| 1135 |
@redundant[Marshalling is performed initially as part of the remote subprogram call in |
| 1136 |
the calling partition; unmarshalling is done in the called partition. |
| 1137 |
After the remote subprogram completes, marshalling is performed in the |
| 1138 |
called partition, and finally unmarshalling is done in the calling |
| 1139 |
partition.] |
| 1140 |
|
| 1141 |
@Defn{calling stub} |
| 1142 |
@Defn{receiving stub} |
| 1143 |
A @i{calling stub} is the sequence of code that replaces the subprogram |
| 1144 |
body of a remotely called subprogram in the calling partition. A |
| 1145 |
@i{receiving stub} is the sequence of code (the @lquotes@;wrapper@rquotes@;) that |
| 1146 |
receives a remote subprogram call on the called partition and invokes |
| 1147 |
the appropriate subprogram body. |
| 1148 |
@begin{Discussion} |
| 1149 |
The use of the term @i{stub} in this annex should not be confused with |
| 1150 |
@nt{body_stub} as defined in @RefSecNum{Subunits of Compilation Units}. The |
| 1151 |
term @i{stub} is used here because it is a commonly understood term when |
| 1152 |
talking about the RPC paradigm. |
| 1153 |
@end{Discussion} |
| 1154 |
|
| 1155 |
@Defn{at-most-once execution} |
| 1156 |
Remote subprogram calls are executed at most once, that is, |
| 1157 |
if the subprogram call returns normally, then the called |
| 1158 |
subprogram's body was executed exactly once. |
| 1159 |
|
| 1160 |
The task executing a remote subprogram call blocks until the subprogram |
| 1161 |
in the called partition returns, unless the call is asynchronous. For an |
| 1162 |
asynchronous remote procedure call, the calling task can |
| 1163 |
become ready before the |
| 1164 |
procedure in the called partition returns. |
| 1165 |
|
| 1166 |
@Defn{cancellation of a remote subprogram call} |
| 1167 |
If a construct containing a remote call is aborted, the |
| 1168 |
remote subprogram call is @i{cancelled}. |
| 1169 |
Whether the execution of the remote subprogram is immediately aborted |
| 1170 |
as a result of the cancellation is implemen@!tation defined. |
| 1171 |
@ImplDef{Whether the execution of the remote subprogram is immediately |
| 1172 |
aborted as a result of cancellation.} |
| 1173 |
|
| 1174 |
If a remote subprogram call is received by a called partition before the |
| 1175 |
partition has |
| 1176 |
completed its elaboration, the call is kept pending until the called |
| 1177 |
partition completes its elaboration (unless the call is |
| 1178 |
cancelled by the calling partition prior to that). |
| 1179 |
|
| 1180 |
If an exception is propagated by a remotely called subprogram, |
| 1181 |
and the call is not an asynchronous call, |
| 1182 |
the corresponding exception is reraised at the point |
| 1183 |
of the remote subprogram call. |
| 1184 |
For an asynchronous call, if the remote procedure call returns prior to |
| 1185 |
the completion of the remotely called subprogram, any exception is lost. |
| 1186 |
|
| 1187 |
The exception Communication_Error |
| 1188 |
(see @RefSecNum{Partition Communication Subsystem}) is raised if a remote call |
| 1189 |
cannot be completed due to difficulties in communicating with the called |
| 1190 |
partition. |
| 1191 |
|
| 1192 |
@PDefn2{Term=[potentially blocking operation],Sec=(remote subprogram call)} |
| 1193 |
@PDefn2{Term=[blocking, potentially],Sec=(remote subprogram call)} |
| 1194 |
All forms of remote subprogram calls are potentially blocking operations |
| 1195 |
(see @RefSecNum{Protected Subprograms and Protected Actions}). |
| 1196 |
@begin{Reason} |
| 1197 |
Asynchronous remote procedure calls are potentially blocking since the |
| 1198 |
implementation may require waiting for the availability of shared resources |
| 1199 |
to initiate the remote call. |
| 1200 |
@end{Reason} |
| 1201 |
|
| 1202 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0085],ARef=[AI95-00215-01]} |
| 1203 |
@IndexCheck{Accessibility_Check} |
| 1204 |
In a remote subprogram call with a formal parameter of a class-wide |
| 1205 |
type, a check is made that the tag of the actual parameter identifies |
| 1206 |
a tagged type declared in a declared-pure or shared passive library |
| 1207 |
unit, or in the visible part of a remote types or remote call interface |
| 1208 |
library unit. |
| 1209 |
@Defn2{Term=[Program_Error],Sec=(raised by failure of run-time check)} |
| 1210 |
Program_Error is raised if this check fails. |
| 1211 |
@Chg{New=[In a remote function call which returns a class-wide type, the same |
| 1212 |
check is made on the function result.],Old=[]} |
| 1213 |
@begin{Discussion} |
| 1214 |
@ChgRef{Version=[1],Kind=[Revised],Ref=[8652/0085],ARef=[AI95-00215-01]} |
| 1215 |
This check makes certain that the specific type passed@Chg{New=[ or returned], |
| 1216 |
Old=[]} in an RPC |
| 1217 |
satisfies the rules for a "communicable" type. Normally this |
| 1218 |
is guaranteed by the compile-time restrictions on remote call interfaces. |
| 1219 |
However, with class-wide types, it is possible to pass an object |
| 1220 |
whose tag identifies a type declared outside the "safe" packages. |
| 1221 |
|
| 1222 |
This is considered an accessibility_check since only the types |
| 1223 |
declared in "safe" packages are considered truly "global" (cross-partition). |
| 1224 |
Other types are local to a single partition. This is analogous |
| 1225 |
to the "accessibility" of global vs. local declarations in |
| 1226 |
a single-partition program. |
| 1227 |
|
| 1228 |
This rule replaces a rule from an early version of Ada 9X |
| 1229 |
which was given in the subclause on Remote Types Library Units |
| 1230 |
(now @RefSec{Remote Types Library Units}). That rule tried |
| 1231 |
to prevent "bad" types from being sent by arranging for their |
| 1232 |
tags to mismatch between partitions. However, that interfered |
| 1233 |
with other uses of tags. The new rule allows tags to agree |
| 1234 |
in all partitions, even for those types which are not "safe" |
| 1235 |
to pass in an RPC. |
| 1236 |
@end{Discussion} |
| 1237 |
|
| 1238 |
@IndexCheck{Partition_Check} |
| 1239 |
In a dispatching call with two or more controlling operands that are |
| 1240 |
designated by values of a remote access-to-class-wide type, |
| 1241 |
a check is made @Redundant[(in addition to the normal Tag_Check |
| 1242 |
@em see @RefSecNum{Suppressing Checks})] that all the remote |
| 1243 |
access-to-class-wide values originated from Access |
| 1244 |
@nt<attribute_reference>s that were evaluated by tasks of the |
| 1245 |
same active partition. |
| 1246 |
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)} |
| 1247 |
Constraint_Error is raised if this check fails. |
| 1248 |
@begin{ImplNote} |
| 1249 |
When a remote access-to-class-wide value is created by |
| 1250 |
an Access @nt<attribute_reference>, the identity of the |
| 1251 |
active partition that evaluated the @nt<attribute_reference> |
| 1252 |
should be recorded in the representation of the remote access value. |
| 1253 |
@end{ImplNote} |
| 1254 |
|
| 1255 |
@end{RunTime} |
| 1256 |
|
| 1257 |
@begin{ImplReq} |
| 1258 |
|
| 1259 |
The implementation of remote subprogram calls shall conform |
| 1260 |
to the PCS interface as defined by the specification of the |
| 1261 |
language-defined package System.RPC |
| 1262 |
(see @RefSecNum{Partition Communication Subsystem}). |
| 1263 |
The calling stub shall use the Do_RPC procedure unless the remote |
| 1264 |
procedure call is asynchronous in which case Do_APC shall be used. |
| 1265 |
On the receiving side, the corresponding receiving stub shall be |
| 1266 |
invoked by the RPC-receiver. |
| 1267 |
@begin{ImplNote} |
| 1268 |
One possible implementation model is as follows: |
| 1269 |
|
| 1270 |
The code for calls to subprograms declared in an RCI |
| 1271 |
package is generated |
| 1272 |
normally, that is, the call-site is the same as for a |
| 1273 |
local subprogram call. |
| 1274 |
The code for the remotely callable subprogram bodies is also generated |
| 1275 |
normally. Subprogram's prologue and epilogue are the same as for a local call. |
| 1276 |
|
| 1277 |
When compiling the specification of an RCI package, the compiler |
| 1278 |
generates calling stubs for each visible subprogram. Similarly, when |
| 1279 |
compiling the body of an RCI package, the compiler generates |
| 1280 |
receiving stubs for each visible subprogram together with the appropriate |
| 1281 |
tables to allow the RPC-receiver to locate the correct receiving stub. |
| 1282 |
|
| 1283 |
For the statically bound remote calls, the identity of the remote |
| 1284 |
partition is statically determined (it is resolved at configuration/link time). |
| 1285 |
|
| 1286 |
@Leading@;The calling stub operates as follows: |
| 1287 |
@begin(Itemize) |
| 1288 |
It allocates (or reuses) a stream of Params_Stream_Type of Initial_Size, |
| 1289 |
and initializes it by repeatedly calling Write operations, |
| 1290 |
first to identify which remote subprogram in the receiving partition |
| 1291 |
is being called, and then to pass the incoming value of each of the |
| 1292 |
@b(in) and @b(in out) parameters of the call. |
| 1293 |
|
| 1294 |
|
| 1295 |
It allocates (or reuses) a stream for the Result, |
| 1296 |
unless a pragma Asynchronous is applied to the procedure. |
| 1297 |
|
| 1298 |
|
| 1299 |
It calls Do_RPC unless a pragma Asynchronous is applied to the procedure |
| 1300 |
in which case it calls Do_APC. An access value designating the message |
| 1301 |
stream allocated and initialized above is passed as the Params parameter. |
| 1302 |
An access value designating the Result stream is passed as the Result |
| 1303 |
parameter. |
| 1304 |
|
| 1305 |
|
| 1306 |
If the pragma Asynchronous is not specified for the procedure, |
| 1307 |
Do_RPC blocks until a reply message arrives, |
| 1308 |
and then returns to the calling stub. |
| 1309 |
The stub returns after extracting |
| 1310 |
from the Result stream, using Read operations, the @b(in out) and @b(out) |
| 1311 |
parameters or the function result. If the reply message |
| 1312 |
indicates that the execution of the remote subprogram propagated |
| 1313 |
an exception, the exception is propagated from Do_RPC to the |
| 1314 |
calling stub, and thence to the point of the original remote subprogram call. |
| 1315 |
If Do_RPC detects that communication with the remote partition has |
| 1316 |
failed, it propagates Communication_Error. |
| 1317 |
|
| 1318 |
@end(Itemize) |
| 1319 |
|
| 1320 |
@Leading@;On the receiving side, the RPC-receiver procedure operates as follows: |
| 1321 |
@begin(Itemize) |
| 1322 |
It is called from the PCS when a remote-subprogram-call message is received. |
| 1323 |
The call originates in some remote call receiver task executed and |
| 1324 |
managed in the context of the PCS. |
| 1325 |
|
| 1326 |
It extracts information from the stream to identify the appropriate |
| 1327 |
receiving stub. |
| 1328 |
|
| 1329 |
The receiving stub extracts the @b(in) and @b(in out) parameters using |
| 1330 |
Read from the stream designated by the Params parameter. |
| 1331 |
|
| 1332 |
The receiving stub calls the actual subprogram body and, upon completion of |
| 1333 |
the subprogram, uses Write to insert the results into the |
| 1334 |
stream pointed to by the Result parameter. The receiving stub returns to |
| 1335 |
the RPC-receiver procedure which in turn returns to the PCS. |
| 1336 |
If the actual subprogram body propagates an exception, it is propagated |
| 1337 |
by the RPC-receiver to the PCS, which handles the exception, |
| 1338 |
and indicates in the reply message that the execution of the |
| 1339 |
subprogram body propagated an exception. The exception occurrence |
| 1340 |
can be represented in the reply message using the Write attribute |
| 1341 |
of Ada.Exceptions.Exception_Occurrence. |
| 1342 |
@end(Itemize) |
| 1343 |
|
| 1344 |
For remote access-to-subprogram types: |
| 1345 |
|
| 1346 |
A value of a remote access-to-subprogram type can be |
| 1347 |
represented by the following components: a reference to the remote partition, |
| 1348 |
an index to the package containing the remote subprogram, and an index to |
| 1349 |
the subprogram within the package. The values of these components are |
| 1350 |
determined at run time when the remote access value is created. |
| 1351 |
These three components serve the same purpose when calling Do_APC/RPC, |
| 1352 |
as in the statically bound remote calls; the only difference is that they |
| 1353 |
are evaluated dynamically. |
| 1354 |
|
| 1355 |
For remote access-to-class-wide types: |
| 1356 |
|
| 1357 |
For each remote access-to-class-wide type, |
| 1358 |
a calling stub is generated for each dispatching operation of |
| 1359 |
the designated type. In addition, receiving stubs are generated to perform |
| 1360 |
the remote dispatching operations in the called partition. The appropriate |
| 1361 |
@nt{subprogram_body} is determined as for a local |
| 1362 |
dispatching call once the receiving stub has been reached. |
| 1363 |
|
| 1364 |
A value of a remote access-to-class-wide type |
| 1365 |
can be represented with the following components: |
| 1366 |
a reference to the remote partition, an index to a table (created one per |
| 1367 |
each such access type) containing addresses of all the dispatching operations |
| 1368 |
of the designated type, and an access value designating the actual remote |
| 1369 |
object. |
| 1370 |
|
| 1371 |
Alternatively, a remote access-to-class-wide value can be represented as |
| 1372 |
a normal access value, pointing to a "stub" object which in turn |
| 1373 |
contains the information mentioned above. A call on any |
| 1374 |
dispatching operation of such a stub object does the remote call, |
| 1375 |
if necessary, using the information in the stub object to locate |
| 1376 |
the target partition, etc. This approach has the advantage that |
| 1377 |
less special-casing is required in the compiler. All access values |
| 1378 |
can remain just a simple address. |
| 1379 |
|
| 1380 |
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)} |
| 1381 |
For a call to Do_RPC or Do_APC: The partition ID of all controlling |
| 1382 |
operands are checked for equality (a Constraint_Error is raised if this |
| 1383 |
check fails). The partition ID value is used for the Partition parameter. |
| 1384 |
An index into the @i{tagged-type-descriptor} is created. This index |
| 1385 |
points to the receiving stub of the class-wide operation. This index and |
| 1386 |
the index to the table (described above) are |
| 1387 |
written to the stream. |
| 1388 |
Then, the actual parameters are marshalled into the message |
| 1389 |
stream. For a controlling operand, only the access value |
| 1390 |
designating the remote object is required (the other two |
| 1391 |
components are already present in the other parameters). |
| 1392 |
|
| 1393 |
On the called partition (after the RPC-receiver has transferred control |
| 1394 |
to the appropriate receiving stub) the parameters are first unmarshalled. |
| 1395 |
Then, the tags of the controlling operands (obtained by dereferencing the |
| 1396 |
pointer to the object) are checked for equality. |
| 1397 |
@Defn2{Term=[Constraint_Error],Sec=(raised by failure of run-time check)} |
| 1398 |
If the check fails Constraint_Error is raised and propagated back to the |
| 1399 |
calling partition, unless it is a result of an asynchronous call. |
| 1400 |
Finally, a dispatching call to the specific subprogram (based on the |
| 1401 |
controlling object's tag) is made. Note that since this subprogram is not |
| 1402 |
in an RCI package, no specific stub is generated for it, it is called |
| 1403 |
normally from the @i{dispatching stub}. |
| 1404 |
|
| 1405 |
@end{ImplNote} |
| 1406 |
|
| 1407 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0086],ARef=[AI95-00159-01]} |
| 1408 |
@ChgAdded{Version=[1],Text=[With respect to shared variables in shared |
| 1409 |
passive library units, the |
| 1410 |
execution of the corresponding subprogram body of a synchronous remote |
| 1411 |
procedure call is considered to be part of the execution of the calling task. |
| 1412 |
The execution of the corresponding subprogram body of an asynchronous remote |
| 1413 |
procedure call proceeds in parallel with the calling task and does not signal |
| 1414 |
the next action of the calling task (see @RefSecNum{Shared Variables}).]} |
| 1415 |
@end{ImplReq} |
| 1416 |
|
| 1417 |
@begin{Notes} |
| 1418 |
A given active partition can both make and receive remote subprogram calls. |
| 1419 |
Thus, an active partition can act as both a client and a server. |
| 1420 |
|
| 1421 |
If a given exception is propagated by a remote |
| 1422 |
subprogram call, but the exception does not exist in the calling |
| 1423 |
partition, the exception can be handled by an @key(others) choice |
| 1424 |
or be propagated to and handled by a third partition. |
| 1425 |
@begin{Discussion} |
| 1426 |
This situation can happen |
| 1427 |
in a case of dynamically nested remote subprogram calls, where an |
| 1428 |
intermediate call executes in a partition that does |
| 1429 |
not include the library unit that defines the exception. |
| 1430 |
@end{Discussion} |
| 1431 |
@end{Notes} |
| 1432 |
|
| 1433 |
@begin{DiffWord95} |
| 1434 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0086],ARef=[AI95-00159-01]} |
| 1435 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Added rules so that tasks can |
| 1436 |
safely access shared passive objects.]} |
| 1437 |
|
| 1438 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0085],ARef=[AI95-00215-01]} |
| 1439 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that the check on |
| 1440 |
class-wide types also applies to values returned from remote subprogram call |
| 1441 |
functions.]} |
| 1442 |
@end{DiffWord95} |
| 1443 |
|
| 1444 |
|
| 1445 |
@LabeledSubClause{Pragma Asynchronous} |
| 1446 |
|
| 1447 |
@begin{Intro} |
| 1448 |
@redundant[This subclause introduces the pragma Asynchronous which allows a |
| 1449 |
remote subprogram call to return prior to completion of the execution |
| 1450 |
of the corresponding remote subprogram body.] |
| 1451 |
@end{Intro} |
| 1452 |
|
| 1453 |
@begin{Syntax} |
| 1454 |
@begin{SyntaxText} |
| 1455 |
@Leading@;The form of a @nt{pragma} Asynchronous is as follows: |
| 1456 |
@end{SyntaxText} |
| 1457 |
|
| 1458 |
@PragmaSyn`@key{pragma} @prag(Asynchronous)(@Syn2{local_name});' |
| 1459 |
@end{Syntax} |
| 1460 |
|
| 1461 |
@begin{Legality} |
| 1462 |
@Leading@;The @nt<local_name> of a pragma Asynchronous shall |
| 1463 |
denote either: |
| 1464 |
@begin{Itemize} |
| 1465 |
One or more remote procedures; |
| 1466 |
the formal parameters of the procedure(s) shall all be of |
| 1467 |
mode @key{in}; |
| 1468 |
|
| 1469 |
The first subtype of a remote access-to-procedure type; |
| 1470 |
the formal parameters |
| 1471 |
of the designated profile of |
| 1472 |
the type shall all be of mode @key{in}; |
| 1473 |
|
| 1474 |
The first subtype of a remote access-to-class-wide type. |
| 1475 |
@end{Itemize} |
| 1476 |
|
| 1477 |
@end{Legality} |
| 1478 |
|
| 1479 |
@begin{StaticSem} |
| 1480 |
@PDefn2{Term=[representation pragma], Sec=(Asynchronous)} |
| 1481 |
@PDefn2{Term=[pragma, representation], Sec=(Asynchronous)} |
| 1482 |
A pragma Asynchronous is a representation pragma. |
| 1483 |
When applied to a type, it specifies the type-related @i{asynchronous} |
| 1484 |
aspect of the type. |
| 1485 |
@end{StaticSem} |
| 1486 |
|
| 1487 |
@begin{RunTime} |
| 1488 |
|
| 1489 |
@Defn2{Term=[remote procedure call],Sec=(asynchronous)} |
| 1490 |
@Defn2{Term=[asynchronous], Sec=(remote procedure call)} |
| 1491 |
A remote call is @i{asynchronous} if it is a call to a procedure, |
| 1492 |
or a call through a value of an access-to-procedure type, to which |
| 1493 |
a pragma Asynchronous applies. |
| 1494 |
In addition, if a pragma Asynchronous applies to a remote |
| 1495 |
access-to-class-wide type, then |
| 1496 |
a dispatching call on a procedure |
| 1497 |
with a controlling operand designated by a value of the type |
| 1498 |
is asynchronous if the |
| 1499 |
formal parameters of the procedure are all of mode @key{in}. |
| 1500 |
@end{RunTime} |
| 1501 |
|
| 1502 |
@begin{ImplReq} |
| 1503 |
|
| 1504 |
Asynchronous remote procedure calls shall be implemented such that the |
| 1505 |
corresponding body executes at most once as a result of the call. |
| 1506 |
@begin{Honest} |
| 1507 |
It is not clear that this rule can be tested or even defined formally. |
| 1508 |
@end{Honest} |
| 1509 |
@end{ImplReq} |
| 1510 |
|
| 1511 |
@LabeledSubClause{Example of Use of a Remote Access-to-Class-Wide Type} |
| 1512 |
|
| 1513 |
@begin{Examples} |
| 1514 |
@Leading@i{Example of using a remote access-to-class-wide type to achieve dynamic binding |
| 1515 |
across active partitions:} |
| 1516 |
@begin{example} |
| 1517 |
@key{package} Tapes @key{is} |
| 1518 |
@key{pragma} Pure(Tapes); |
| 1519 |
@key{type} Tape @key{is abstract tagged limited private}; |
| 1520 |
@RI{-- Primitive dispatching operations where} |
| 1521 |
@RI{-- Tape is controlling operand} |
| 1522 |
@key{procedure} Copy (From, To : @key{access} Tape; Num_Recs : @key[in] Natural) @key{is} @key{abstract}; |
| 1523 |
@key{procedure} Rewind (T : @key{access} Tape) @key{is} @key{abstract}; |
| 1524 |
@RI{-- More operations} |
| 1525 |
@key{private} |
| 1526 |
@key{type} Tape @key{is} ... |
| 1527 |
@key{end} Tapes; |
| 1528 |
|
| 1529 |
@key{with} Tapes; |
| 1530 |
@key{package} Name_Server @key{is} |
| 1531 |
@key{pragma} Remote_Call_Interface; |
| 1532 |
@RI{-- Dynamic binding to remote operations is achieved} |
| 1533 |
@RI{-- using the access-to-limited-class-wide type Tape_Ptr} |
| 1534 |
@key{type} Tape_Ptr @key{is access all} Tapes.Tape'Class; |
| 1535 |
@RI{-- The following statically bound remote operations} |
| 1536 |
@RI{-- allow for a name-server capability in this example} |
| 1537 |
@key{function} Find (Name : String) @key{return} Tape_Ptr; |
| 1538 |
@key{procedure} Register (Name : @key[in] String; T : @key[in] Tape_Ptr); |
| 1539 |
@key{procedure} Remove (T : @key[in] Tape_Ptr); |
| 1540 |
@RI{-- More operations} |
| 1541 |
@key{end} Name_Server; |
| 1542 |
|
| 1543 |
@key{package} Tape_Driver @key{is} |
| 1544 |
@RI{-- Declarations are not shown, they are irrelevant here} |
| 1545 |
@key{end} Tape_Driver; |
| 1546 |
|
| 1547 |
@key{with} Tapes, Name_Server; |
| 1548 |
@key{package body} Tape_Driver @key{is} |
| 1549 |
@key{type} New_Tape @key{is new} Tapes.Tape @key{with} ... |
| 1550 |
@key{procedure} Copy |
| 1551 |
(From, To : @key{access} New_Tape; Num_Recs: @key[in] Natural) @key{is} |
| 1552 |
@key{begin} |
| 1553 |
. . . |
| 1554 |
@key{end} Copy; |
| 1555 |
@key{procedure} Rewind (T : @key{access} New_Tape) @key{is} |
| 1556 |
@key{begin} |
| 1557 |
. . . |
| 1558 |
@key{end} Rewind; |
| 1559 |
@RI{-- Objects remotely accessible through use} |
| 1560 |
@RI{-- of Name_Server operations} |
| 1561 |
Tape1, Tape2 : @key[aliased] New_Tape; |
| 1562 |
@key{begin} |
| 1563 |
Name_Server.Register ("NINE-TRACK", Tape1'Access); |
| 1564 |
Name_Server.Register ("SEVEN-TRACK", Tape2'Access); |
| 1565 |
@key{end} Tape_Driver; |
| 1566 |
|
| 1567 |
@key{with} Tapes, Name_Server; |
| 1568 |
@RI{-- Tape_Driver is not needed and thus not mentioned in the @nt{with_clause}} |
| 1569 |
@key{procedure} Tape_Client @key{is} |
| 1570 |
T1, T2 : Name_Server.Tape_Ptr; |
| 1571 |
@key{begin} |
| 1572 |
T1 := Name_Server.Find ("NINE-TRACK"); |
| 1573 |
T2 := Name_Server.Find ("SEVEN-TRACK"); |
| 1574 |
Tapes.Rewind (T1); |
| 1575 |
Tapes.Rewind (T2); |
| 1576 |
Tapes.Copy (T1, T2, 3); |
| 1577 |
@key{end} Tape_Client; |
| 1578 |
@end{example} |
| 1579 |
|
| 1580 |
@leading@keepnext@i{Notes on the example}: |
| 1581 |
@begin{Discussion} |
| 1582 |
The example does not show the case where tapes are removed from or added to |
| 1583 |
the system. In the former case, an appropriate exception needs to be defined |
| 1584 |
to instruct the client to use another tape. In the latter, the Name_Server |
| 1585 |
should have a query function visible to the clients to inform them about the |
| 1586 |
availability of the tapes in the system. |
| 1587 |
@end{Discussion} |
| 1588 |
|
| 1589 |
@ChgRef{Version=[1], Kind=[Deleted]} |
| 1590 |
@Chg[New=<>,Old=<@ @;@comment{Empty paragraph to hang junk paragraph number from original RM}>] |
| 1591 |
|
| 1592 |
@begin{itemize} |
| 1593 |
The package Tapes provides the necessary declarations of the type and its |
| 1594 |
primitive operations. |
| 1595 |
|
| 1596 |
Name_Server is a remote call interface package and is elaborated in a separate |
| 1597 |
active partition to provide the necessary naming services (such as Register |
| 1598 |
and Find) to the entire distributed program |
| 1599 |
through remote subprogram calls. |
| 1600 |
|
| 1601 |
Tape_Driver is a normal package that is elaborated in a partition configured |
| 1602 |
on the processing node that is connected to the tape device(s). The abstract |
| 1603 |
operations are overridden to support |
| 1604 |
the locally declared tape devices (Tape1, Tape2). The package is not visible |
| 1605 |
to its clients, but it exports the tape devices (as remote objects) |
| 1606 |
through the services of the Name_Server. This allows for tape devices to be |
| 1607 |
dynamically added, removed or replaced without requiring the modification of |
| 1608 |
the clients' code. |
| 1609 |
|
| 1610 |
The Tape_Client procedure references only declarations in the Tapes and |
| 1611 |
Name_Server packages. Before using a tape for the first time, it needs to |
| 1612 |
query the Name_Server for a system-wide identity for that tape. From then on, |
| 1613 |
it can use that identity to access the tape device. |
| 1614 |
|
| 1615 |
Values of remote access type Tape_Ptr include the necessary information to |
| 1616 |
complete the remote dispatching operations that result from |
| 1617 |
dereferencing the controlling operands T1 and T2. |
| 1618 |
|
| 1619 |
@end{itemize} |
| 1620 |
@end{Examples} |
| 1621 |
|
| 1622 |
|
| 1623 |
@LabeledClause{Partition Communication Subsystem} |
| 1624 |
|
| 1625 |
@begin{Intro} |
| 1626 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00273-01]} |
| 1627 |
@Defn{partition communication subsystem (PCS)} |
| 1628 |
@Defn{PCS (partition communication subsystem)} |
| 1629 |
@redundant[The @i{Partition Communication Subsystem} (PCS) provides facilities for |
| 1630 |
supporting communication between the active partitions of a distributed |
| 1631 |
program. The package System.RPC is a language-defined interface to the |
| 1632 |
PCS.]@Chg{Version=[2],New=[],Old=[ An implementation conforming to this |
| 1633 |
Annex shall use the RPC interface to implement remote subprogram calls.]} |
| 1634 |
@begin{Reason} |
| 1635 |
The prefix RPC is used rather than RSC because the term remote procedure call |
| 1636 |
and its acronym are more familiar. |
| 1637 |
@end{Reason} |
| 1638 |
@end{Intro} |
| 1639 |
|
| 1640 |
@begin{StaticSem} |
| 1641 |
|
| 1642 |
@leading@keepnext@;The following language-defined library package exists: |
| 1643 |
@begin{example} |
| 1644 |
@b(with) Ada.Streams; @RI{-- see @RefSecNum[The Package Streams]} |
| 1645 |
@key(package) System.RPC @key(is)@ChildUnit{Parent=[System],Child=[RPC]} |
| 1646 |
|
| 1647 |
@key(type) @AdaTypeDefn{Partition_Id} @key(is range) 0 .. @RI(implementation-defined); |
| 1648 |
|
| 1649 |
@AdaExcDefn{Communication_Error} : @key(exception); |
| 1650 |
|
| 1651 |
@key(type) @AdaTypeDefn{Params_Stream_Type} ( |
| 1652 |
Initial_Size : Ada.Streams.Stream_Element_Count) @key(is) @key(new) |
| 1653 |
Ada.Streams.Root_Stream_Type @key(with) @key(private); |
| 1654 |
|
| 1655 |
@key(procedure) @AdaSubDefn{Read}( |
| 1656 |
Stream : @key(in out) Params_Stream_Type; |
| 1657 |
Item : @key(out) Ada.Streams.Stream_Element_Array; |
| 1658 |
Last : @key(out) Ada.Streams.Stream_Element_Offset); |
| 1659 |
|
| 1660 |
@key(procedure) @AdaSubDefn{Write}( |
| 1661 |
Stream : @key(in out) Params_Stream_Type; |
| 1662 |
Item : @key(in) Ada.Streams.Stream_Element_Array); |
| 1663 |
|
| 1664 |
|
| 1665 |
@RI(-- Synchronous call) |
| 1666 |
@key(procedure) @AdaSubDefn{Do_RPC}( |
| 1667 |
Partition : @key(in) Partition_Id; |
| 1668 |
Params : @key(access) Params_Stream_Type; |
| 1669 |
Result : @key(access) Params_Stream_Type); |
| 1670 |
|
| 1671 |
@RI(-- Asynchronous call) |
| 1672 |
@key(procedure) @AdaSubDefn{Do_APC}( |
| 1673 |
Partition : @key(in) Partition_Id; |
| 1674 |
Params : @key(access) Params_Stream_Type); |
| 1675 |
|
| 1676 |
@RI(-- The handler for incoming RPCs) |
| 1677 |
@key(type) @AdaTypeDefn{RPC_Receiver} @key(is access procedure)( |
| 1678 |
Params : @key(access) Params_Stream_Type; |
| 1679 |
Result : @key(access) Params_Stream_Type); |
| 1680 |
|
| 1681 |
@key(procedure) @AdaSubDefn{Establish_RPC_Receiver}( |
| 1682 |
Partition : @key(in) Partition_Id; |
| 1683 |
Receiver : @key(in) RPC_Receiver); |
| 1684 |
|
| 1685 |
@key[private] |
| 1686 |
... -- @RI{not specified by the language} |
| 1687 |
@b(end) System.RPC; |
| 1688 |
@end{example} |
| 1689 |
|
| 1690 |
A value of the type Partition_Id is used to identify a partition. |
| 1691 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[ |
| 1692 |
The range of type System.RPC.Partition_Id.]}]} |
| 1693 |
|
| 1694 |
An object of the type Params_Stream_Type is used for identifying |
| 1695 |
the particular remote subprogram that is being called, as |
| 1696 |
well as marshalling and |
| 1697 |
unmarshalling the parameters or result of a remote |
| 1698 |
subprogram call, as part of sending them between partitions. |
| 1699 |
|
| 1700 |
@redundant[The Read and Write procedures override the corresponding abstract operations |
| 1701 |
for the type Params_Stream_Type.] |
| 1702 |
|
| 1703 |
@end{StaticSem} |
| 1704 |
|
| 1705 |
@begin{RunTime} |
| 1706 |
|
| 1707 |
The Do_RPC and Do_APC procedures send a message to the active partition |
| 1708 |
identified by the Partition parameter. |
| 1709 |
@begin{ImplNote} |
| 1710 |
It is assumed that the RPC interface is above the message-passing |
| 1711 |
layer of the network protocol stack and is implemented in terms of it. |
| 1712 |
@end{ImplNote} |
| 1713 |
|
| 1714 |
After sending the message, Do_RPC blocks the calling task until a reply |
| 1715 |
message comes back from the called partition or some error is detected by |
| 1716 |
the underlying communication system in which case Communication_Error is |
| 1717 |
raised at the point of the call to Do_RPC. |
| 1718 |
@begin{Reason} |
| 1719 |
Only one exception is defined in System.RPC, although many sources of errors |
| 1720 |
might exist. This is so because it is not always possible |
| 1721 |
to distinguish among these errors. In particular, it is often impossible to |
| 1722 |
tell the difference between a failing communication link and |
| 1723 |
a failing processing node. Additional information might be associated with |
| 1724 |
a particular Exception_Occurrence for a Communication_Error. |
| 1725 |
@end{Reason} |
| 1726 |
|
| 1727 |
Do_APC operates in the same way as Do_RPC except that it |
| 1728 |
is allowed to return immediately after sending the message. |
| 1729 |
|
| 1730 |
Upon normal return, the stream designated by the Result parameter |
| 1731 |
of Do_RPC contains the reply message. |
| 1732 |
|
| 1733 |
@PDefn2{Term=[elaboration], Sec=(partition)} |
| 1734 |
The procedure System.RPC.Establish_RPC_Receiver is called |
| 1735 |
once, immediately after elaborating |
| 1736 |
the library units of an active partition |
| 1737 |
(that is, right after the @i{elaboration of the partition}) if the partition |
| 1738 |
includes an RCI library unit, but prior to invoking the main |
| 1739 |
subprogram, if any. |
| 1740 |
The Partition parameter is the Partition_Id of the active partition |
| 1741 |
being elaborated. |
| 1742 |
@Defn{RPC-receiver} |
| 1743 |
The Receiver parameter designates an |
| 1744 |
implementation-provided procedure called the |
| 1745 |
@i{RPC-receiver} which will handle all RPCs received by the |
| 1746 |
partition from the PCS. |
| 1747 |
Establish_RPC_Receiver saves a reference to the RPC-receiver; |
| 1748 |
when a message is received at the called partition, the RPC-receiver |
| 1749 |
is called with the Params stream containing |
| 1750 |
the message. When the RPC-receiver |
| 1751 |
returns, the contents of the stream designated by Result is |
| 1752 |
placed in a message and sent back to the calling partition. |
| 1753 |
@begin{ImplNote} |
| 1754 |
It is defined by the PCS implementation whether one or more threads of control |
| 1755 |
should be available to process incoming messages and to wait for their |
| 1756 |
completion. |
| 1757 |
@end{ImplNote} |
| 1758 |
@begin{ImplNote} |
| 1759 |
At link-time, the linker provides the RPC-receiver and the necessary tables |
| 1760 |
to support it. A call on Establish_RPC_Receiver is inserted just before |
| 1761 |
the call on the main subprogram. |
| 1762 |
@end{ImplNote} |
| 1763 |
@begin{Reason} |
| 1764 |
The interface between the PCS (the System.RPC package) and the |
| 1765 |
RPC-receiver is defined to be dynamic in order to allow the elaboration |
| 1766 |
sequence to notify the PCS that all packages have been |
| 1767 |
elaborated and that it is safe to call the receiving stubs. It is not |
| 1768 |
guaranteed that the PCS units will be the last to be elaborated, so some |
| 1769 |
other indication that elaboration is complete is needed. |
| 1770 |
@end{Reason} |
| 1771 |
|
| 1772 |
If a call on Do_RPC is aborted, a cancellation message is sent |
| 1773 |
to the called partition, to request that the execution of the |
| 1774 |
remotely called subprogram be aborted. |
| 1775 |
@begin{Honest} |
| 1776 |
The full effects of this message are dependent on the implementation of |
| 1777 |
the PCS. |
| 1778 |
@end{Honest} |
| 1779 |
|
| 1780 |
@PDefn2{Term=[potentially blocking operation],Sec=(RPC operations)} |
| 1781 |
@PDefn2{Term=[blocking, potentially],Sec=(RPC operations)} |
| 1782 |
The subprograms declared in System.RPC are potentially |
| 1783 |
blocking operations. |
| 1784 |
@end{RunTime} |
| 1785 |
|
| 1786 |
@begin{ImplReq} |
| 1787 |
The implementation of the RPC-receiver shall be reentrant@Redundant[, |
| 1788 |
thereby allowing concurrent calls on it from the PCS to service |
| 1789 |
concurrent remote subprogram calls into the partition]. |
| 1790 |
@begin{Reason} |
| 1791 |
There seems no reason to allow the implementation of RPC-receiver |
| 1792 |
to be nonreentrant, even though we don't require that every |
| 1793 |
implementation of the PCS actually perform concurrent calls |
| 1794 |
on the RPC-receiver. |
| 1795 |
@end{Reason} |
| 1796 |
|
| 1797 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0087],ARef=[AI95-00082-01]} |
| 1798 |
@ChgAdded{Version=[1],Text=[An implementation shall not restrict the |
| 1799 |
replacement of the body of |
| 1800 |
System.RPC. An implementation shall not restrict children of System.RPC. |
| 1801 |
@Redundant[The related implementation permissions in the introduction to |
| 1802 |
Annex A do not apply.]]} |
| 1803 |
@begin{Reason} |
| 1804 |
@ChgRef{Version=[1],Kind=[Added]} |
| 1805 |
@ChgAdded{Version=[1],Text=[The point of System.RPC is to let the user tailor |
| 1806 |
the communications |
| 1807 |
mechanism without requiring changes to or other cooperation from the compiler. |
| 1808 |
However, implementations can restrict the replacement of language-defined units. |
| 1809 |
This requirement overrides that permission for System.RPC.]} |
| 1810 |
@end{Reason} |
| 1811 |
@ChgRef{Version=[1],Kind=[Added],Ref=[8652/0087],ARef=[AI95-00082-01]} |
| 1812 |
@ChgAdded{Version=[1],Text=[If the implementation of System.RPC is provided by |
| 1813 |
the user, an implementation shall support remote subprogram calls as specified.]} |
| 1814 |
@begin{Discussion} |
| 1815 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00273-01]} |
| 1816 |
@ChgAdded{Version=[2],Text=[If the implementation takes advantage of the |
| 1817 |
implementation permission to use a different specification for System.RPC, |
| 1818 |
it still needs to use it for remote subprogram calls, and allow the user |
| 1819 |
to replace the body of System.RPC. It just isn't guaranteed to be portable |
| 1820 |
to do so in Ada 2005 - an advantage which was more theoretical than real |
| 1821 |
anyway.]} |
| 1822 |
@end{Discussion} |
| 1823 |
@end{ImplReq} |
| 1824 |
|
| 1825 |
@begin{DocReq} |
| 1826 |
|
| 1827 |
The implementation of the PCS shall document whether |
| 1828 |
the RPC-receiver is invoked from concurrent tasks. If there is an |
| 1829 |
upper limit on the number of such tasks, this limit shall be documented as |
| 1830 |
well, together with the mechanisms to configure it (if this is supported). |
| 1831 |
@ChgImplDef{Version=[2],Kind=[Deleted],Text=[@ChgDeleted{Version=[2], |
| 1832 |
Text=[Implementation-defined aspects of the PCS.]}]} |
| 1833 |
@ChgDocReq{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 1834 |
Text=[Whether the RPC-receiver is invoked from concurrent tasks, and if so, |
| 1835 |
the number of such tasks.]}]} |
| 1836 |
|
| 1837 |
@end{DocReq} |
| 1838 |
|
| 1839 |
@begin{ImplPerm} |
| 1840 |
|
| 1841 |
The PCS is allowed to contain implementation-defined interfaces for |
| 1842 |
explicit message passing, broadcasting, etc. Similarly, it is allowed |
| 1843 |
to provide additional |
| 1844 |
interfaces to query the state of some remote partition (given its partition |
| 1845 |
ID) or of the PCS itself, to set timeouts and retry parameters, to get more |
| 1846 |
detailed error status, etc. These |
| 1847 |
additional interfaces should be provided in child packages of System.RPC. |
| 1848 |
@ImplDef{Implementation-defined interfaces in the PCS.} |
| 1849 |
|
| 1850 |
A body for the package System.RPC need not be supplied by the |
| 1851 |
implementation. |
| 1852 |
@begin{Reason} |
| 1853 |
It is presumed that a body for the package System.RPC might be |
| 1854 |
extremely environment specific. Therefore, we do not require |
| 1855 |
that a body be provided by the (compiler) implementation. The user |
| 1856 |
will have to write a body, or acquire one, appropriate for the |
| 1857 |
target environment. |
| 1858 |
@end{Reason} |
| 1859 |
|
| 1860 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00273-01]} |
| 1861 |
@ChgAdded{Version=[2],Text=[An alternative declaration is allowed for |
| 1862 |
package System.RPC as long as it provides a set of operations that is |
| 1863 |
substantially equivalent to the specification defined in this clause.]} |
| 1864 |
@begin{Reason} |
| 1865 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1866 |
@ChgAdded{Version=[2],Text=[Experience has proved that the definition |
| 1867 |
of System.RPC given here is inadequate for interfacing to existing |
| 1868 |
distribution mechanisms (such as CORBA), especially on heterogeneous |
| 1869 |
systems. Rather than mandate a change in the mechanism (which would |
| 1870 |
break existing systems), require implementations to support multiple |
| 1871 |
mechanisms (which is impractical), or prevent the use of Annex E facilities |
| 1872 |
with existing systems (which would be silly), we simply make this facility |
| 1873 |
optional.]} |
| 1874 |
|
| 1875 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1876 |
@ChgAdded{Version=[2],Text=[One of the purposes behind System.RPC was |
| 1877 |
that knowledgeable users, rather than compiler vendors, could create |
| 1878 |
this package tailored to their networks. Experience has shown that |
| 1879 |
users get their RPC from vendors anyway; users have not taken advantage |
| 1880 |
of the flexibility provided by this defined interface. Moreover, one |
| 1881 |
could compare this defined interface to requiring Ada compilers to use |
| 1882 |
a defined interface to implement tasking. No one thinks that the latter is |
| 1883 |
a good idea, why should anyone believe that the former is?]} |
| 1884 |
|
| 1885 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1886 |
@ChgAdded{Version=[2],Text=[Therefore, this clause is made optional. |
| 1887 |
We considered deleting the clause outright, but we still require that |
| 1888 |
users may replace the package (whatever its interface). Also, it still |
| 1889 |
provides a useful guide to the implementation of this feature.]} |
| 1890 |
@end{Reason} |
| 1891 |
@end{ImplPerm} |
| 1892 |
|
| 1893 |
@begin{ImplAdvice} |
| 1894 |
|
| 1895 |
Whenever possible, the PCS on the called partition should |
| 1896 |
allow for multiple tasks to call the RPC-receiver with |
| 1897 |
different messages and should allow them to block until the corresponding |
| 1898 |
subprogram body returns. |
| 1899 |
@ChgImplAdvice{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2], |
| 1900 |
Text=[The PCS should allow for multiple tasks to call the RPC-receiver.]}]} |
| 1901 |
|
| 1902 |
The Write operation on a stream of type Params_Stream_Type should raise |
| 1903 |
Storage_Error if it runs out of space trying to write the Item |
| 1904 |
into the stream. |
| 1905 |
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 1906 |
Text=[The System.RPC.Write operation should raise Storage_Error if it runs out |
| 1907 |
of space when writing an item.]}]} |
| 1908 |
@begin{ImplNote} |
| 1909 |
An implementation could also dynamically allocate more space |
| 1910 |
as needed, only propagating Storage_Error if the @nt<allocator> |
| 1911 |
it calls raises Storage_Error. This storage could be managed |
| 1912 |
through a controlled component of the stream object, to |
| 1913 |
ensure that it is reclaimed when the stream object |
| 1914 |
is finalized. |
| 1915 |
@end{ImplNote} |
| 1916 |
|
| 1917 |
@end{ImplAdvice} |
| 1918 |
|
| 1919 |
@begin{Notes} |
| 1920 |
The package System.RPC is not designed for direct calls by user |
| 1921 |
programs. It is instead designed for use in the implementation of remote |
| 1922 |
subprograms calls, being called by the calling stubs generated for a |
| 1923 |
remote call interface library unit to initiate a remote call, |
| 1924 |
and in turn calling back to an |
| 1925 |
RPC-receiver that dispatches to the receiving stubs generated |
| 1926 |
for the body of a remote call interface, to handle a remote call |
| 1927 |
received from elsewhere. |
| 1928 |
@end{Notes} |
| 1929 |
|
| 1930 |
@begin{Incompatible95} |
| 1931 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00273-01]} |
| 1932 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 1933 |
The specification of System.RPC can now be |
| 1934 |
tailored for an implementation. If a program replaces the body of System.RPC |
| 1935 |
with a user-defined body, it might not compile in a given implementation |
| 1936 |
of Ada 2005 (if the specification of System.RPC has been changed).]} |
| 1937 |
@end{Incompatible95} |
| 1938 |
|
| 1939 |
@begin{DiffWord95} |
| 1940 |
@ChgRef{Version=[2],Kind=[AddedNormal],Ref=[8652/0087],ARef=[AI95-00082-01]} |
| 1941 |
@ChgAdded{Version=[2],Text=[@b<Corrigendum:> Clarified that the user can |
| 1942 |
replace System.RPC.]} |
| 1943 |
@end{DiffWord95} |