http://libre.act-europe.fr © act europe under the gnu free documentation license 1 franco gasperoni...

95
1 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License Franco Gasperoni Franco Gasperoni [email protected] [email protected] http://libre.act- http://libre.act- europe.fr europe.fr

Upload: lester-golden

Post on 03-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

1http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Franco GasperoniFranco Gasperoni

[email protected]@act-europe.fr

http://libre.act-europe.frhttp://libre.act-europe.fr

Page 2: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

2http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Copyright NoticeCopyright Notice

• © ACT Europe under the GNU Free Documentation License© ACT Europe under the GNU Free Documentation License

• Permission is granted to copy, distribute and/or modify this Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free License, Version 1.1 or any later version published by the Free Software Foundation; provided its original author is mentioned Software Foundation; provided its original author is mentioned and the link to http://libre.act-europe.fr/ is kept at the bottom of and the link to http://libre.act-europe.fr/ is kept at the bottom of every non-title slide. A copy of the license is available at: every non-title slide. A copy of the license is available at:

• http://www.fsf.org/licenses/fdl.htmlhttp://www.fsf.org/licenses/fdl.html

Page 3: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

3http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Page 4: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

4http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• IntroductionIntroduction

• Distributed Prog. ParadigmsDistributed Prog. Paradigms

• Distributed Object Distributed Object

TechnologiesTechnologies

• ConclusionConclusion

Page 5: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

5http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• Non-distributed applicationNon-distributed application = single process = single process– running on a single computerrunning on a single computer

• Distributed applicationDistributed application = several communicating = several communicating processesprocesses– processes often run on different computers processes often run on different computers – computers are connected through a networkcomputers are connected through a network

Page 6: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

6http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

processprocess

Single Process ApplicationSingle Process Application

body

spec

main

body

spec

body

spec

Page 7: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

7http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Distributed Application Distributed Application

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

ApplicationApplication

Page 8: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

8http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

All Processes Can Run on the All Processes Can Run on the Same Computer Same Computer

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

Page 9: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

9http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Or They can run on Different Or They can run on Different Computers Computers

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

Page 10: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

10http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

In All Cases This Requires In All Cases This Requires Inter-Process CommunicationInter-Process Communication

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

Page 11: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

11http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

body

spec

body

spec

body

spec

main

processprocess

????

Page 12: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

12http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

The Main Topic of this The Main Topic of this LectureLecture

• How distributed processes communicate at How distributed processes communicate at the the programmingprogramming level level

• How the “How the “software chunkssoftware chunks” of a distributed ” of a distributed app can app can interactinteract..

• This lecture will NOT teach you how they This lecture will NOT teach you how they communicate at thecommunicate at the– physical levelphysical level– or protocol levelor protocol level

Page 13: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

13http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Remember OSI Layers ?Remember OSI Layers ?

ApplicationApplication

PresentationPresentation

Transport

Network

Data Link

Physical

SessionSession

ApplicationApplication

PresentationPresentation

Transport

Network

Data Link

Physical

SessionSession } {This is whatThis is whatwe will look atwe will look at

Page 14: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

14http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

ApplicationApplication

PresentationPresentation

Transport

Network

Data Link

Physical

SessionSession

Telnet, ftp, …

Sending data in platform indep. manner

Establish communication bw processes

TCP, UDP, ...

IP, X.25, ...

Network drivers

The wire

Page 15: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

15http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Why Distributed Apps ?Why Distributed Apps ?

• Multiuser apps (e.g. e-mail, ftp)Multiuser apps (e.g. e-mail, ftp)• Sharing data (e.g. www, airline reservation)Sharing data (e.g. www, airline reservation)• Sharing resources (e.g. printers)Sharing resources (e.g. printers)• Fault toleranceFault tolerance• App may be inherently distributed (cell phones, App may be inherently distributed (cell phones,

ATM machines, …)ATM machines, …)

Page 16: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

16http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Distributed Prog. Is HardDistributed Prog. Is Hard

• Multiple failure modesMultiple failure modes– each individual process can fail (bugs, machine crash..)each individual process can fail (bugs, machine crash..)– the network can go ashtraythe network can go ashtray

• Security issuesSecurity issues– is someone else listeningis someone else listening

• Testing & debuggingTesting & debugging• Distributed prog. technologies not fully matureDistributed prog. technologies not fully mature

– interoperability is still an issueinteroperability is still an issue

Page 17: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

17http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• IntroductionIntroduction

• Distributed Prog. Distributed Prog.

ParadigmsParadigms– Message Sending (Sockets)Message Sending (Sockets)

– Remote Procedure CallsRemote Procedure Calls

– Distributed ObjectsDistributed Objects

Page 18: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

18http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

bodybody

processprocess

specspec

processprocess

??

How to Formalize the Notion of an How to Formalize the Notion of an Interface in a Distributed Interface in a Distributed

Environment ?Environment ?

Page 19: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

19http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

How to Formalize the Notion of an How to Formalize the Notion of an Interface in a Distributed Interface in a Distributed

Environment ?Environment ?

• Answer 1Answer 1: don’t formalize it, send a message: don’t formalize it, send a message– e.g. socketse.g. sockets

• Answer 2Answer 2: Remote Procedure Call (RPC): Remote Procedure Call (RPC)

• Answer 3Answer 3: RPCs + Distributed Objects: RPCs + Distributed Objects– Language dependent: Ada 95, Java RMILanguage dependent: Ada 95, Java RMI– Language independent: CORBA, COM/DCOMLanguage independent: CORBA, COM/DCOM

Page 20: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

20http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

A Simple ComparisonA Simple Comparison

Object-OrientedObject-OrientedProgrammingProgramming

Object-OrientedObject-OrientedProgrammingProgramming

Programming withProgramming withGOTOsGOTOs

Programming withProgramming withGOTOsGOTOs

StructuredStructuredProgrammingProgramming

StructuredStructuredProgrammingProgramming

Distributed ObjectsDistributed ObjectsDistributed ObjectsDistributed Objects

Message SendingMessage Sending(sockets)(sockets)

Message SendingMessage Sending(sockets)(sockets)

RPCsRPCsRPCsRPCs

Page 21: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

21http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Some TerminologySome Terminology

bodybodyspecspec

Client:Client: the code that madethe code that madethe request for servicethe request for service

Client:Client: the code that madethe code that madethe request for servicethe request for service Server:Server: the code that the code that

answered the requestanswered the requestServer:Server: the code that the code that

answered the requestanswered the request

Page 22: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

22http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Answer 1: Don’t Formalize ItAnswer 1: Don’t Formalize ItSend a Message (e.g. Sockets)Send a Message (e.g. Sockets)

Send (…, Bytes);Send (…, Bytes); ReceiveReceive (…, & Bytes [ ]);(…, & Bytes [ ]);

Page 23: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

23http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Client ProcessClient ProcessClient ProcessClient Process

time

Server ProcessServer ProcessServer ProcessServer Process

time

Wait for connectionWait for connectionWait for connectionWait for connection

ComputeComputeComputeCompute

Send bytesSend bytesSend bytesSend bytes

Close socketClose socketClose socketClose socket

Open socketOpen socketOpen socketOpen socket

Get bytesGet bytesGet bytesGet bytes

Open socketOpen socketOpen socketOpen socket

ComputeComputeComputeCompute

Send bytesSend bytesSend bytesSend bytes

Wait for replyWait for replyWait for replyWait for reply

Close socketClose socketClose socketClose socket

Get bytesGet bytesGet bytesGet bytes

raw bytesraw bytes

raw bytesraw bytes

Page 24: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

24http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

What are the problemsWhat are the problems

with this approach ?with this approach ?

Page 25: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

25http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Problems with Problems with Sockets/Message SendingSockets/Message Sending

• No interfaces - very low-level programmingNo interfaces - very low-level programming– does not scale updoes not scale up

• Sockets exchange bytesSockets exchange bytes– How do you exchange more complex data structures ?How do you exchange more complex data structures ?– How do you handle heterogeneous systems ?How do you handle heterogeneous systems ?

Page 26: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

26http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

ClientClientClientClient

time

ServerServerServerServer

time

Answer requestAnswer requestAnswer requestAnswer request

ComputeComputeComputeComputeWait for replyWait for replyWait for replyWait for reply

ComputeComputeComputeCompute

Get responseGet responseGet responseGet response

Send requestSend requestSend requestSend requestdatadata

Send responseSend responseSend responseSend response

datadata

Doesn’t this look familiar ?Doesn’t this look familiar ?Doesn’t this look familiar ?Doesn’t this look familiar ?Wait for requestWait for requestWait for requestWait for request

Page 27: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

27http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Answer 2: Remote Procedure CallsAnswer 2: Remote Procedure Calls

R := Foo (123);R := Foo (123);

function Foo function Foo (X : Integer)(X : Integer) return Float; return Float;

Page 28: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

28http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

ClientClientClientClient

time

ServerServerServerServer

time

function Foo (X: Integer)function Foo (X: Integer) return Float return Float isis … …beginbegin … … return …;return …;end Foo;end Foo;

function Foo (X: Integer)function Foo (X: Integer) return Float return Float isis … …beginbegin … … return …;return …;end Foo;end Foo;

Wait for replyWait for replyWait for replyWait for reply

ComputeComputeComputeCompute

Get resultGet resultGet resultGet result

R := Foo (123);R := Foo (123);R := Foo (123);R := Foo (123);send parameterssend parameters

send result or modified parameterssend result or modified parameters

RPCRPCRPCRPC

Page 29: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

29http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

RPCsRPCs

• Remote procedure call completely handled by the Remote procedure call completely handled by the systemsystem

• Parameters and results passed across the Parameters and results passed across the network without programmer interventionnetwork without programmer intervention

• Heterogeneity handled transparentlyHeterogeneity handled transparently

Page 30: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

30http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Where is the Magic ?Where is the Magic ?

R := Foo (123);R := Foo (123);

function Foo function Foo (X : Integer)(X : Integer) return Float; return Float;

Page 31: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

31http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Client Stub & Server SkeletonClient Stub & Server Skeleton• From the server spec the system generates a From the server spec the system generates a

client stub:client stub:– Marshals the parametersMarshals the parameters– Sends the request over the networkSends the request over the network– Waits for the response and unmarshals the resultWaits for the response and unmarshals the result

• From the server spec (and server body) the From the server spec (and server body) the system generates a server skeletonsystem generates a server skeleton– Receives the RPC requestReceives the RPC request– unmarshals the parametersunmarshals the parameters– Selects and calls the appropriate subprogramSelects and calls the appropriate subprogram– Marshals the result and sends the responseMarshals the result and sends the response

Page 32: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

32http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

SpecialSpecialCompilerCompiler

SpecialSpecialCompilerCompiler

Stubs & SkeletonsStubs & Skeletons

function Foo function Foo (X : Integer)(X : Integer) return Float; return Float;

Client Stub Client Stub Server Skeleton Server Skeleton

function Foo (X: Integer)function Foo (X: Integer) return Float return Float isis … …end Foo;end Foo;

Page 33: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

33http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

R := Foo (123);R := Foo (123);

function Foo function Foo (X : Integer)(X : Integer) return Float; return Float;

Client StubClient Stub

Server Server Skeleton Skeleton

function Foo (X: Integer)function Foo (X: Integer) return Float return Float isis … …end Foo;end Foo;

Page 34: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

34http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

networknetwork

ClientClientClientClient ServerServerServerServer

function Foo (X : Integer) return Float is ...function Foo (X : Integer) return Float is ...function Foo (X : Integer) return Float is ...function Foo (X : Integer) return Float is ...

ClientClientClientClient ServerServerServerServer

function Foofunction Foofunction Foofunction Foonetworknetwork

callcall

returnreturn

callcall

returnreturn

parameterparametermarshallingmarshalling

callcall

returnreturn

resultresultunmarshallingunmarshalling

resultresultmarshallingmarshalling

resultresultunmarshallingunmarshalling

Client StubClient StubClient StubClient Stub Server SkeletonServer SkeletonServer SkeletonServer Skeleton

Page 35: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

35http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Enhancing RPCsEnhancing RPCs

• ExceptionsExceptions

– exceptions raised in the callee canbe transmitted to exceptions raised in the callee canbe transmitted to

the caller over the networkthe caller over the network

• Asynchronous callsAsynchronous calls

– the caller does not need to wait for the result from the the caller does not need to wait for the result from the

callee (one way procedure calls)callee (one way procedure calls)

• Pointers on remote proceduresPointers on remote procedures– RPC through a pointer. At the point of call the spec of RPC through a pointer. At the point of call the spec of

the callee is known but not its location or identitythe callee is known but not its location or identity

Page 36: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

36http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Service Related to RPCs:Service Related to RPCs:NamingNaming

• Records the location of the various processesRecords the location of the various processes– location of client stubs and server skeletonslocation of client stubs and server skeletons

• This service is called via RPCThis service is called via RPC

• To solve the circularity problem the naming To solve the circularity problem the naming service is at a known machine addressservice is at a known machine address

Page 37: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

37http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Answer 3: Distributed ObjectsAnswer 3: Distributed Objects

A: Alert’Class := Get_Alert;A: Alert’Class := Get_Alert;……Handle (A);Handle (A);

type Alert is tagged record…;type Alert is tagged record…;procedure Handle (A : in out Alert);procedure Handle (A : in out Alert);

Dynamic Dynamic

BindingBindingtype Medium_Alert is new Alert...;type Medium_Alert is new Alert...;procedure Handle (A : in out Medium_Alert);procedure Handle (A : in out Medium_Alert);

??

Page 38: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

38http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• IntroductionIntroduction

• Distributed Prog. ParadigmsDistributed Prog. Paradigms

• Distributed Object Distributed Object

TechnologiesTechnologies– Language Dependent: Ada 95Language Dependent: Ada 95

– Language Independent: CORBALanguage Independent: CORBA

Page 39: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

39http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

LanguageLanguage DependentDependentDistributed Objects ParadigmDistributed Objects Paradigm

bodybody

spec spec

The The samesame programming language is used to write programming language is used to write • the spec of the distributed servicesthe spec of the distributed services• the implementation of the server codethe implementation of the server code• the implementation of the client codethe implementation of the client code

The The samesame programming language is used to write programming language is used to write • the spec of the distributed servicesthe spec of the distributed services• the implementation of the server codethe implementation of the server code• the implementation of the client codethe implementation of the client code

Page 40: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

40http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

LanguageLanguage IndependentIndependentDistributed Objects ParadigmDistributed Objects Paradigm

ClientClientlanguage Alanguage A

ServerServerlanguage Blanguage B

specspeclanguage Blanguage B

Different languagesDifferent languages are used to write: are used to write: • the spec of the distributed servicesthe spec of the distributed services• the implementation of the server codethe implementation of the server code• the implementation of the client codethe implementation of the client code

Different languagesDifferent languages are used to write: are used to write: • the spec of the distributed servicesthe spec of the distributed services• the implementation of the server codethe implementation of the server code• the implementation of the client codethe implementation of the client code

language indep.language indep.spec spec

Page 41: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

41http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• IntroductionIntroduction

• Distributed Prog. ParadigmsDistributed Prog. Paradigms

• Distributed Object Distributed Object

TechnologiesTechnologies– Language Dependent: Ada 95Language Dependent: Ada 95

– Language Independent: CORBALanguage Independent: CORBA

Page 42: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

42

Ada 95Ada 95Distributed Systems AnnexDistributed Systems Annex

Page 43: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

43http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Ada 95 Distributed Ada 95 Distributed ProgrammingProgramming

Ada 95Ada 95

partitionpartition(process)(process)

multi-partitionsmulti-partitions

CoreCore Annex EAnnex E

A partition comprises one or more Ada packagesA partition comprises one or more Ada packagesA partition comprises one or more Ada packagesA partition comprises one or more Ada packages

Page 44: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

44http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Supported ParadigmsSupported Paradigms

• Client/Server Paradigm (RPC)Client/Server Paradigm (RPC)

– Synchronous / AsynchronousSynchronous / Asynchronous

– Static / DynamicStatic / Dynamic

• Distributed Objects Distributed Objects

• Shared MemoryShared Memory

Page 45: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

45http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Ada Distributed ApplicationAda Distributed Application• No need for a separate interfacing language as No need for a separate interfacing language as

in CORBA (IDL)in CORBA (IDL)– Ada is the IDLAda is the IDL

• Some packages categorized using pragmasSome packages categorized using pragmas– Remote_Call_Interface (RCI)Remote_Call_Interface (RCI)– Remote_TypesRemote_Types– Shared_Passive (SP)Shared_Passive (SP)

• All packages except All packages except RCIRCI & & SPSP duplicated on duplicated on partitions using thempartitions using them

Page 46: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

46http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Remote_Call_Interface (RCI)Remote_Call_Interface (RCI)

• Allows subprograms to be called remotelyAllows subprograms to be called remotely

– Statically bound RPCsStatically bound RPCs

– Dynamically bound RPCs Dynamically bound RPCs (remote access to subprogram)(remote access to subprogram)

Page 47: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

47http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Remote_TypesRemote_Types

• Allows the definition of a remote access typesAllows the definition of a remote access types

– Remote access to subprogramRemote access to subprogram

– Remote reference to objects Remote reference to objects (ability to do dynamically dispatching calls (ability to do dynamically dispatching calls across the network)across the network)

Page 48: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

48http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Shared_PassiveShared_Passive

• A Shared_Passive package contains variables A Shared_Passive package contains variables that can be accessed from distinct partitionsthat can be accessed from distinct partitions

• Allows support of shared distributed memoryAllows support of shared distributed memory

• Allows persistence on some implementationsAllows persistence on some implementations

Page 49: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

49http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

1.1. Write app as if non distributed.Write app as if non distributed.

2.2. Identify remote procedures, shared variables, and Identify remote procedures, shared variables, and distributed objects &distributed objects & categorizecategorize packages.packages.

3.3. Build & test non-distributed application.Build & test non-distributed application.

4.4. Write a configuration file for Write a configuration file for partitionningpartitionning your app.your app.

5.5. Build partitions & test distributed app.Build partitions & test distributed app.

package P is .

package P is .

package P is .

package P is .

package P is .

package P is .

package P is .

package P is .

package P is .

package P is .

Building a Distributed App in Building a Distributed App in Ada 95Ada 95

Page 50: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

50http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Remote_Call_InterfaceRemote_Call_Interface

An ExampleAn Example

Page 51: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

51http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package TypesTypes is is type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

package package TypesTypes is is type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is function function Get_PGet_P ( (D: DeviceD: Device) return ) return PressurePressure;; function function Get_TGet_T ( (D: DeviceD: Device) return ) return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is function function Get_PGet_P ( (D: DeviceD: Device) return ) return PressurePressure;; function function Get_TGet_T ( (D: DeviceD: Device) return ) return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_1Client_1 is is P := Sensors.Get_P (Boiler);P := Sensors.Get_P (Boiler);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_1Client_1 is is P := Sensors.Get_P (Boiler);P := Sensors.Get_P (Boiler);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_2Client_2 is is T := Sensors.Get_T (Furnace);T := Sensors.Get_T (Furnace);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_2Client_2 is is T := Sensors.Get_T (Furnace);T := Sensors.Get_T (Furnace);

Write AppWrite App

Page 52: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

52http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P (D:Device)Get_P (D:Device) return return PressurePressure;; function function Get_T (D:Device)Get_T (D:Device) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P (D:Device)Get_P (D:Device) return return PressurePressure;; function function Get_T (D:Device)Get_T (D:Device) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_1Client_1 is is P := Sensors.Get_P (Boiler);P := Sensors.Get_P (Boiler);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_1Client_1 is is P := Sensors.Get_P (Boiler);P := Sensors.Get_P (Boiler);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_2Client_2 is is T := Sensors.Get_T (Furnace);T := Sensors.Get_T (Furnace);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_2Client_2 is is T := Sensors.Get_T (Furnace);T := Sensors.Get_T (Furnace);

CategorizeCategorize

Page 53: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

53http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Build & TestBuild & Test

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P (D:Device)Get_P (D:Device) return return PressurePressure;; function function Get_T (D:Device)Get_T (D:Device) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P (D:Device)Get_P (D:Device) return return PressurePressure;; function function Get_T (D:Device)Get_T (D:Device) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_1Client_1 is is P := Sensors.Get_P (Boiler);P := Sensors.Get_P (Boiler);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_1Client_1 is is P := Sensors.Get_P (Boiler);P := Sensors.Get_P (Boiler);

Page 54: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

54http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Build & TestBuild & Test

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is ( is (Furnace, BoilerFurnace, Boiler,…);,…); type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P (D:Device)Get_P (D:Device) return return PressurePressure;; function function Get_T (D:Device)Get_T (D:Device) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P (D:Device)Get_P (D:Device) return return PressurePressure;; function function Get_T (D:Device)Get_T (D:Device) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_2Client_2 is is T := Sensors.Get_T (Furnace);T := Sensors.Get_T (Furnace);

with with TypesTypes; use ; use TypesTypes;;with with SensorsSensors;;procedure procedure Client_2Client_2 is is T := Sensors.Get_T (Furnace);T := Sensors.Get_T (Furnace);

Page 55: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

55http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

configuration configuration Config_1Config_1 is is Node_ANode_A : Partition := ( : Partition := (SensorsSensors);); Node_BNode_B : Partition := ( : Partition := (Client_1Client_1);); Node_CNode_C : Partition := ( : Partition := (Client_2Client_2););end end Config_1Config_1;;

configuration configuration Config_1Config_1 is is Node_ANode_A : Partition := ( : Partition := (SensorsSensors);); Node_BNode_B : Partition := ( : Partition := (Client_1Client_1);); Node_CNode_C : Partition := ( : Partition := (Client_2Client_2););end end Config_1Config_1;;

PartitionPartition

Page 56: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

56http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

PartitionPartition

Node_ANode_A

Node_BNode_B Node_CNode_C

Page 57: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

57http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is …; is …; type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

package package TypesTypes is is pragma pragma PurePure;; type type DeviceDevice is …; is …; type type PressurePressure is …; is …; type type TemperatureTemperature is …; is …;end end TypesTypes;;

DUPLICATEDDUPLICATED Node_ANode_A

Node_BNode_B Node_CNode_C

Page 58: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

58http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P(…)Get_P(…) return return PressurePressure;; function function Get_T(…)Get_T(…) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P(…)Get_P(…) return return PressurePressure;; function function Get_T(…)Get_T(…) return return TemperatureTemperature;;end end SensorsSensors;;

STUBSSTUBSNode_ANode_A

Node_BNode_B Node_CNode_C

Page 59: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

59http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P(…)Get_P(…) return return PressurePressure;; function function Get_T(…)Get_T(…) return return TemperatureTemperature;;end end SensorsSensors;;

with with TypesTypes; use ; use TypesTypes;;package package SensorsSensors is is pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; function function Get_P(…)Get_P(…) return return PressurePressure;; function function Get_T(…)Get_T(…) return return TemperatureTemperature;;end end SensorsSensors;;

SKELETONSKELETON+ BODY+ BODY

Node_ANode_A

Node_BNode_B Node_CNode_C

Page 60: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

60http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

…….:= Sensors.Get_P (Boiler);.:= Sensors.Get_P (Boiler);…….:= Sensors.Get_P (Boiler);.:= Sensors.Get_P (Boiler);

Sensors.Get_PSensors.Get_P StubStubSensors.Get_PSensors.Get_P StubStub

Marshal ArgumentsMarshal ArgumentsMarshal ArgumentsMarshal Arguments

SendSend ReceiveReceive

Sensors.Get_PSensors.Get_P bodybody

Unmarshal ArgumentsUnmarshal ArgumentsUnmarshal ArgumentsUnmarshal Arguments

SkeletonSkeletonSkeletonSkeletonSelect bodySelect bodySelect bodySelect body

Node_BNode_B Node_ANode_A

Page 61: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

61http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with Types; use Types;package Sensors is pragma Remote_Call_InterfaceRemote_Call_Interface; … procedure Log (D : Device; P : Pressure); pragma AsynchronousAsynchronous (Log);

end Bank;

with Types; use Types;package Sensors is pragma Remote_Call_InterfaceRemote_Call_Interface; … procedure Log (D : Device; P : Pressure); pragma AsynchronousAsynchronous (Log);

end Bank;

Asynchronous CallsAsynchronous Calls

+ returns immediately+ exceptions are lost+ parameters must be in

Page 62: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

62http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Remote_TypesRemote_Types

An ExampleAn Example

Page 63: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

63http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package AlertsAlerts is is type type AlertAlert is abstract tagged private; is abstract tagged private; typetype Alert_Ref Alert_Ref is access allis access all Alert’Class; Alert’Class; procedure procedure Handle (A : Handle (A : accessaccess Alert); Alert); procedure procedure Log (A : Log (A : accessaccess Alert) Alert) is abstractis abstract;; privateprivate ......end end Alerts;Alerts;

package package AlertsAlerts is is type type AlertAlert is abstract tagged private; is abstract tagged private; typetype Alert_Ref Alert_Ref is access allis access all Alert’Class; Alert’Class; procedure procedure Handle (A : Handle (A : accessaccess Alert); Alert); procedure procedure Log (A : Log (A : accessaccess Alert) Alert) is abstractis abstract;; privateprivate ......end end Alerts;Alerts;

package package Alerts.Pool Alerts.Pool isis procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

Write AppWrite App

Page 64: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

64http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package Alerts.LowAlerts.Low is is type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

with with Alerts.Pool; Alerts.Pool; use use Alerts.Pool;Alerts.Pool;package body package body Alerts.Low Alerts.Low isis ......beginbegin Register (Register (newnew Low_Alert); Low_Alert); end end AlertsAlerts..Low;Low;

with with Alerts.Pool; Alerts.Pool; use use Alerts.Pool;Alerts.Pool;package body package body Alerts.Low Alerts.Low isis ......beginbegin Register (Register (newnew Low_Alert); Low_Alert); end end AlertsAlerts..Low;Low;

Page 65: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

65http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package Alerts.Medium Alerts.Medium isis type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

with with Alerts.Pool; Alerts.Pool; use use Alerts.Pool;Alerts.Pool;package body package body Alerts.Medium Alerts.Medium isis ......beginbegin Register (Register (newnew Medium_Alert); Medium_Alert); end end AlertsAlerts..Medium;Medium;

with with Alerts.Pool; Alerts.Pool; use use Alerts.Pool;Alerts.Pool;package body package body Alerts.Medium Alerts.Medium isis ......beginbegin Register (Register (newnew Medium_Alert); Medium_Alert); end end AlertsAlerts..Medium;Medium;

Page 66: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

66http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package AlertsAlerts is is pragmapragma Remote_TypesRemote_Types; type type AlertAlert is abstract tagged private; is abstract tagged private; typetype Alert_Ref Alert_Ref is access allis access all Alert’Class; Alert’Class; procedure procedure Handle (A : Handle (A : accessaccess Alert); Alert); procedure procedure Log (A : Log (A : accessaccess Alert) Alert) is abstractis abstract;; privateprivate ......end end Alerts;Alerts;

package package AlertsAlerts is is pragmapragma Remote_TypesRemote_Types; type type AlertAlert is abstract tagged private; is abstract tagged private; typetype Alert_Ref Alert_Ref is access allis access all Alert’Class; Alert’Class; procedure procedure Handle (A : Handle (A : accessaccess Alert); Alert); procedure procedure Log (A : Log (A : accessaccess Alert) Alert) is abstractis abstract;; privateprivate ......end end Alerts;Alerts;package package Alerts.Pool Alerts.Pool isis

pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

CategorizeCategorize

Page 67: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

67http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Page 68: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

68http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

package package AlertsAlerts is is pragmapragma Remote_TypesRemote_Types; type type AlertAlert is abstract tagged private; is abstract tagged private; typetype Alert_Ref Alert_Ref is access allis access all Alert’Class; Alert’Class; procedure procedure Handle (A : Handle (A : accessaccess Alert); Alert); procedure procedure Log (A : Log (A : accessaccess Alert) Alert) is abstractis abstract;; privateprivate ......end end Alerts;Alerts;

package package AlertsAlerts is is pragmapragma Remote_TypesRemote_Types; type type AlertAlert is abstract tagged private; is abstract tagged private; typetype Alert_Ref Alert_Ref is access allis access all Alert’Class; Alert’Class; procedure procedure Handle (A : Handle (A : accessaccess Alert); Alert); procedure procedure Log (A : Log (A : accessaccess Alert) Alert) is abstractis abstract;; privateprivate ......end end Alerts;Alerts;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

Build & Build & TestTest

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Page 69: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

69http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

configuration configuration Config_2Config_2 is is Node_ALNode_AL : Partition := ( : Partition := (Alerts.LowAlerts.Low);); Node_AMNode_AM : Partition := ( : Partition := (Alerts.MediumAlerts.Medium);); Node_BNode_B : Partition := ( : Partition := (Alerts.PoolAlerts.Pool);); Node_CNode_C : Partition := ( : Partition := (Process_AlertsProcess_Alerts););end end Config_2Config_2;;

configuration configuration Config_2Config_2 is is Node_ALNode_AL : Partition := ( : Partition := (Alerts.LowAlerts.Low);); Node_AMNode_AM : Partition := ( : Partition := (Alerts.MediumAlerts.Medium);); Node_BNode_B : Partition := ( : Partition := (Alerts.PoolAlerts.Pool);); Node_CNode_C : Partition := ( : Partition := (Process_AlertsProcess_Alerts););end end Config_2Config_2;;

PartitionPartition

Page 70: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

70http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

What HappensWhat HappensWhen ExecutingWhen Executing

the Distributed Program ?the Distributed Program ?

Page 71: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

71http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Node_ALNode_AL Node_AMNode_AM

Node_BNode_B Node_CNode_C

Step 1: A Low_Alert object in Node_AL registers itself with Node_BStep 1: A Low_Alert object in Node_AL registers itself with Node_BStep 1: A Low_Alert object in Node_AL registers itself with Node_BStep 1: A Low_Alert object in Node_AL registers itself with Node_B

Page 72: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

72http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Node_ALNode_AL Node_AMNode_AM

Node_BNode_B Node_CNode_C

Step 2: A Medium_Alert object in Node_AM registers itself with Node_BStep 2: A Medium_Alert object in Node_AM registers itself with Node_BStep 2: A Medium_Alert object in Node_AM registers itself with Node_BStep 2: A Medium_Alert object in Node_AM registers itself with Node_B

Page 73: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

73http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Node_ALNode_AL Node_AMNode_AM

Node_BNode_B Node_CNode_C

Step 3: Process_Alerts in Node_C does an RPC to Get_Alert in Node_BStep 3: Process_Alerts in Node_C does an RPC to Get_Alert in Node_BStep 3: Process_Alerts in Node_C does an RPC to Get_Alert in Node_BStep 3: Process_Alerts in Node_C does an RPC to Get_Alert in Node_B

Page 74: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

74http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Node_ALNode_AL Node_AMNode_AM

Node_BNode_B Node_CNode_C

Step 4: Get_Alert returns a pointer to an Alert object (Low_Alert or Medium_Alert)Step 4: Get_Alert returns a pointer to an Alert object (Low_Alert or Medium_Alert)Step 4: Get_Alert returns a pointer to an Alert object (Low_Alert or Medium_Alert)Step 4: Get_Alert returns a pointer to an Alert object (Low_Alert or Medium_Alert)

Page 75: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

75http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

with with Alerts, Alerts.Pool;Alerts, Alerts.Pool; use use Alerts;Alerts;procedure procedure Process_Alerts Process_Alerts isisbeginbegin looploop Handle (Pool.Get_Alert);Handle (Pool.Get_Alert); end loop;end loop;end end Process_Alerts;Process_Alerts;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.LowAlerts.Low is is pragmapragma Remote_TypesRemote_Types; type type Low_AlertLow_Alert is new is new Alert Alert with private;with private; procedure procedure Log (A : Log (A : accessaccess Low_Alert); Low_Alert);privateprivate ......end end Alerts.Low;Alerts.Low;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Pool Alerts.Pool isis pragma pragma Remote_Call_InterfaceRemote_Call_Interface;; procedure procedure Register (A : Alert_Ref);Register (A : Alert_Ref); function function Get_Alert Get_Alert return return Alert_Ref;Alert_Ref;end end Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

package package Alerts.Medium Alerts.Medium isis pragmapragma Remote_TypesRemote_Types; type type Medium_AlertMedium_Alert is new is new Alert Alert with private;with private; procedure procedure Handle (A : Handle (A : accessaccess Medium_Alert); Medium_Alert); procedure procedure Log (A : Log (A : accessaccess Medium_Alert); Medium_Alert);privateprivate ......end end AlertsAlerts..Medium;Medium;

Node_ALNode_AL Node_AMNode_AM

Node_BNode_B Node_CNode_C

Step 5: Node_C performs a dispatching RPC. It calls Handle in Node_AL or Node_AMStep 5: Node_C performs a dispatching RPC. It calls Handle in Node_AL or Node_AMStep 5: Node_C performs a dispatching RPC. It calls Handle in Node_AL or Node_AMStep 5: Node_C performs a dispatching RPC. It calls Handle in Node_AL or Node_AM

??

Page 76: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

76http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

What Does Get_Alert Return ?What Does Get_Alert Return ?

PointerPointer

MachineMachineAddress of Address of Alert object Alert object

on the on the MachineMachine

Get_AlertGet_AlertGet_AlertGet_Alert

Page 77: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

77http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Remote Access to Class Wide Remote Access to Class Wide TypeType

• At compile time:At compile time:

– You do not know what operation you’ll You do not know what operation you’ll dispatch todispatch to

– On what node that operations will be On what node that operations will be executed onexecuted on

Page 78: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

78http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• IntroductionIntroduction

• Distributed Prog. ParadigmsDistributed Prog. Paradigms

• Distributed Object Distributed Object

TechnologiesTechnologies– Language Dependent: Ada 95Language Dependent: Ada 95

– Language Independent: CORBALanguage Independent: CORBA

Page 79: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

79http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

LanguageLanguage IndependentIndependentDistributed Objects ParadigmDistributed Objects Paradigm

ClientClientlanguage Alanguage A

ServerServerlanguage Blanguage B

specspeclanguage Blanguage B

Different languagesDifferent languages are used to write: are used to write: • the spec of the distributed servicesthe spec of the distributed services• the implementation of the server codethe implementation of the server code• the implementation of the client codethe implementation of the client code

Different languagesDifferent languages are used to write: are used to write: • the spec of the distributed servicesthe spec of the distributed services• the implementation of the server codethe implementation of the server code• the implementation of the client codethe implementation of the client code

language indep.language indep.Spec (IDL) Spec (IDL)

Page 80: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

80http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

CORBA InterfacesCORBA Interfaces

• In Corba interfaces are described in IDL In Corba interfaces are described in IDL – (Interface Description Language) (Interface Description Language)

• The IDL is independent of programming languagesThe IDL is independent of programming languages• Each interface is translated inEach interface is translated in

– Language A used for the client (client stub)Language A used for the client (client stub)– Language B used for the server (server skeleton)Language B used for the server (server skeleton)

• To implement the server the programmer completes To implement the server the programmer completes the skeleton in language Bthe skeleton in language B

• To implement the client the programmer uses the To implement the client the programmer uses the services provided by th estub in language Aservices provided by th estub in language A

Page 81: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

81http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

The CORBA ArchitectureThe CORBA Architecture

• RPC go through the ORB RPC go through the ORB – (Object Request Broker)(Object Request Broker)

• The ORB is a software busThe ORB is a software bus

• ORBs communicate with a set of standardised ORBs communicate with a set of standardised protocols protocols – IIOP, GIOPIIOP, GIOP

Page 82: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

82http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

The IDLThe IDL

• Syntax similar to C++ with some Ada additionsSyntax similar to C++ with some Ada additions

• IDL must be translatable in various prog. LanguagesIDL must be translatable in various prog. Languages

– Ada, C, C++, Java, …Ada, C, C++, Java, …

• There are limitations in what you can write in the IDLThere are limitations in what you can write in the IDL

• Programmer must understand how the IDL is Programmer must understand how the IDL is

translated in the host language translated in the host language

– to complete the server skeleton to complete the server skeleton

– to use the client stubto use the client stub

Page 83: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

83http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

ExampleExample

package M ispackage M is pragma Remote_Types;pragma Remote_Types; type T is tagged …;type T is tagged …; procedure P (O : in access T);procedure P (O : in access T);end M;end M;

module M {module M { interface T {interface T { void P ();void P (); };};};};

Page 84: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

84http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

ExempleExemplemodule Echo {

string echoStringechoString (in string mesg);

};

Module foo {

interface Buffer {

exception Empty;

void put (in string content);

string get() raises (Empty);

}

};

Page 85: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

85http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Example of IDL translation in AdaExample of IDL translation in Ada

with Corba.Object;package Echo is type Ref is new Corba.Object.Ref with null record; function To_Echo (Self : in Corba.Object.Ref’Class) return Ref’Class; function To_Ref (From : in Corba.Any) return Ref; function To_Any (From : in Ref) return Corba.Any; function echoStringechoString (Self : in Ref; msg : in Corba.String) return Corba.String; Null_Ref : constant Ref := (Corba.Object.Null_Ref with null record); Echo_R_Id : constant Corba.RepositoryId := Corba.To_Unbounded_String («IDL:Echo:1.0»);end Echo;

Page 86: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

86http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

CORBA ServicesCORBA Services

• The CORBA core services are very fewThe CORBA core services are very few

• Lot ’s of external servicesLot ’s of external services– Naming (distributed and hierarchical)Naming (distributed and hierarchical)– PersistancePersistance– TransactionTransaction– SecuritySecurity– ......

Page 87: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

87http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

ApplicationApplicationObjectsObjects

Object ServicesObject Services

CommonCommonFacilitiesFacilities

O R BO R B

Code you Code you writewrite

Code you Code you writewrite

Domain Domain IndependentIndependent

Domain Domain IndependentIndependent

Domain Domain SpecificSpecificDomain Domain SpecificSpecific

Page 88: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

88http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

• IntroductionIntroduction

• Distributed Prog. ParadigmsDistributed Prog. Paradigms

• Distributed Object Distributed Object

TechnologiesTechnologies

• ConclusionConclusion

Page 89: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

89http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Developing a Distributed AppDeveloping a Distributed App

• Using network services directlyUsing network services directly– SocketsSockets

• Using middlewareUsing middleware– CORBACORBA– COM/DCOMCOM/DCOM

• Using a distributed languageUsing a distributed language– Ada 95 DSAAda 95 DSA– Java RMIJava RMI

Similar issueswith

Tasking

Similar issueswith

Tasking

Page 90: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

90http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Impact on Development PhasesImpact on Development Phases

GeneralGeneralDesignDesign

GeneralGeneralDesignDesign

DistributedDistributedDesignDesign

DistributedDistributedDesignDesign

CodingCodingCodingCoding

TestingTestingTestingTesting

Page 91: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

91http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

SocketsSockets

GeneralGeneralDesignDesign

GeneralGeneralDesignDesign

DistributedDistributedDesignDesign

DistributedDistributedDesignDesign

CodingCodingCodingCoding

TestingTestingTestingTesting

Ad HocAd Hoc

Very low levelVery low level

Distributed Distributed mode onlymode only

Page 92: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

92http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

CodingCodingCodingCoding

Very low levelVery low level

• Everything must be done with socketsEverything must be done with sockets• Data marshaling/unmarshallingData marshaling/unmarshalling• Handle heterogeneous systems directlyHandle heterogeneous systems directly

Page 93: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

93http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

CORBACORBA

GeneralGeneralDesignDesign

GeneralGeneralDesignDesign

DistributedDistributedDesignDesign

DistributedDistributedDesignDesign

CodingCodingCodingCoding

TestingTestingTestingTesting

IDLIDL

Must invoke high-level Must invoke high-level services directlyservices directly

Distributed Distributed mode onlymode only

Page 94: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

94http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Ada 95 DSAAda 95 DSA

GeneralGeneralDesignDesign

GeneralGeneralDesignDesign

DistributedDistributedDesignDesign

DistributedDistributedDesignDesign

CodingCodingCodingCoding

TestingTestingTestingTesting

Ada 95Ada 95

distributeddistributed& non-distributed& non-distributed

Regular AdaRegular AdaCodingCoding

Page 95: Http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License 1 Franco Gasperoni gasperon@act-europe.fr

95http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License

Ada 95 DSA & CORBA:Ada 95 DSA & CORBA:BenefitsBenefits

• Save developer’s time, in socket programming:Save developer’s time, in socket programming:– Defining a client/server protocolDefining a client/server protocol– Defining a message formatDefining a message format– Marshalling of dataMarshalling of data– Unmarshalling dataUnmarshalling data

• Raise the level of abstractionRaise the level of abstraction