SlideShare uma empresa Scribd logo
1 de 95
Baixar para ler offline
Franco Gasperoni
                             gasperon@act-europe.fr
                             http://libre.act-europe.fr

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

           • © ACT Europe under the GNU Free Documentation License

           • Permission is granted to copy, distribute and/or modify this
             document under the terms of the GNU Free Documentation
             License, Version 1.1 or any later version published by the Free
             Software Foundation; provided its original author is mentioned
             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:
           •                          http://www.fsf.org/licenses/fdl.html




                                                                                            2
http://libre.act-europe.fr          © ACT Europe under the GNU Free Documentation License
3
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
• Introduction
                             • Distributed Prog. Paradigms
                             • Distributed Object Technologies
                             • Conclusion



                                                                                             4
http://libre.act-europe.fr           © ACT Europe under the GNU Free Documentation License
• Non-distributed application = single process
         – running on a single computer


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



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


                                                 body

                             spec

                                                                                        main
                             body
                                    spec


                                                                        process
                                    body




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

                                           spec
                                           body
                             spec
                                                   main                                              spec
                             body
                                    spec                                                             body
                                              process                            spec
                                    body
                                                                                                            main
                                                                                 body
                                                                                              spec
                                                                                                        process
                                                                                              body

                                                              spec
                                                              body

                                                                                        Application
                                            spec
                                                                      main
                                            body
                                                       spec
                                                                 process
                                                       body




                                                                                                                   7
http://libre.act-europe.fr                 © ACT Europe under the GNU Free Documentation License
All Processes Can Run on the
                    Same Computer

                                           spec
                                           body
                             spec
                                                   main                                              spec
                             body
                                    spec                                                             body
                                              process                            spec
                                    body
                                                                                                            main
                                                                                 body
                                                                                              spec
                                                                                                        process
                                                                                              body

                                                              spec
                                                              body
                                            spec
                                                                      main
                                            body
                                                       spec
                                                                 process
                                                       body




                                                                                                                   8
http://libre.act-europe.fr                 © ACT Europe under the GNU Free Documentation License
Or They can run on Different
                       Computers
                               spec
                               body
              spec
                                      main
              body
                        spec
                                  process                                                                                 spec
                        body
                                                                                                                          body
                                                                                                            spec
                                                                                                                                 main
                                                                                                            body
                                                                                                                   spec
                                                                                                                             process
                                                                                                                   body




                                                             spec
                                                             body
                                             spec
                                                                    main
                                             body
                                                      spec
                                                                process
                                                      body




                                                                                                                                        9
http://libre.act-europe.fr                          © ACT Europe under the GNU Free Documentation License
In All Cases This Requires
            Inter-Process Communication

                                           spec
                                           body
                             spec
                                                   main                                              spec
                             body
                                    spec                                                             body
                                              process                            spec
                                    body
                                                                                                            main
                                                                                 body
                                                                                              spec
                                                                                                        process
                                                                                              body

                                                              spec
                                                              body
                                            spec
                                                                      main
                                            body
                                                       spec
                                                                 process
                                                       body




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


                                                                                ?
              body
                        spec
                                  process                                                                                 spec
                        body
                                                                                                                          body
                                                                                                            spec
                                                                                                                                 main
                                                                                                            body




                                                    ?
                                                                                                                   spec
                                                                                                                             process
                                                                                                                   body




                                                             spec
                                                             body
                                             spec
                                                                    main
                                             body
                                                      spec
                                                                process
                                                      body




                                                                                                                                        11
http://libre.act-europe.fr                          © ACT Europe under the GNU Free Documentation License
The Main Topic of this Lecture
           • How distributed processes communicate at
             the programming level

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

           • This lecture will NOT teach you how they
             communicate at the
                  – physical level
                  – or protocol level
                                                                                         12
http://libre.act-europe.fr       © ACT Europe under the GNU Free Documentation License
Remember OSI Layers ?



                                 }                                         {
                  Application                                                            Application
                                  This is what
                 Presentation                                                            Presentation
                                 we will look at
                      Session                                                              Session
                     Transport                                                            Transport
                      Network                                                              Network
                     Data Link                                                            Data Link
                      Physical                                                             Physical


                                                                                                        13
http://libre.act-europe.fr       © ACT Europe under the GNU Free Documentation License
Telnet, ftp, …
          Application
                             Sending data in platform indep. manner
        Presentation
                             Establish communication bw processes
              Session
                             TCP, UDP, ...
             Transport
              Network        IP, X.25, ...
             Data Link       Network drivers
              Physical       The wire



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

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



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

      • Multiple failure modes
             – each individual process can fail (bugs, machine crash..)
             – the network can go ashtray
      • Security issues
             – is someone else listening
      • Testing & debugging
      • Distributed prog. technologies not fully mature
             – interoperability is still an issue

                                                                                         16
http://libre.act-europe.fr       © ACT Europe under the GNU Free Documentation License
• Introduction
                             • Distributed Prog. Paradigms
                               – Message Sending (Sockets)
                               – Remote Procedure Calls
                               – Distributed Objects




                                                                                               17
http://libre.act-europe.fr             © ACT Europe under the GNU Free Documentation License
How to Formalize the Notion of an
 Interface in a Distributed Environment ?



                                                        ?                         spec
                             body


              process

                                                                                            process




                                                                                                      18
http://libre.act-europe.fr          © ACT Europe under the GNU Free Documentation License
How to Formalize the Notion of an
 Interface in a Distributed Environment ?

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


           • Answer 2: Remote Procedure Call (RPC)

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

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

                        Programming with                                Message Sending
                             GOTOs                                         (sockets)




                               Structured
                                                                                     RPCs
                              Programming




                             Object-Oriented
                                                                      Distributed Objects
                              Programming


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



                                                                                   spec
                              body



      Client: the code that made
                                                                                    Server: the code that
        the request for service
                                                                                     answered the request



                                                                                                       21
http://libre.act-europe.fr           © ACT Europe under the GNU Free Documentation License
Answer 1: Don’t Formalize It
                 Send a Message (e.g. Sockets)




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




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


                                                                                                              Open socket
                Open socket

                                                                                                              Wait for connection


                    Compute

                                                         raw bytes
                  Send bytes                                                                                  Get bytes


               Wait for reply                                                                                 Compute


                                                                                                              Send bytes
                    Get bytes
                                                           raw bytes

                                                                                                              Close socket
               Close socket


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

                              with this approach ?




                                                                                           24
http://libre.act-europe.fr         © ACT Europe under the GNU Free Documentation License
Problems with
                   Sockets/Message Sending

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


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




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



                                        Doesn’t this look familiar ?
                     Compute                                                                                  Wait for request




                                                            data
               Send request                                                                                   Answer request


               Wait for reply                                                                                 Compute


                                                                                                              Send response
               Get response
                                                              data




                                                                                                                                 26
                                 time                                                                  time
http://libre.act-europe.fr                    © ACT Europe under the GNU Free Documentation License
Answer 2: Remote Procedure Calls


                                                                                                 function Foo
                                                                                                    (X : Integer)
                                                                                                    return Float;




                       R := Foo (123);




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



                                                            RPC
                     Compute




                                                    send parameters
             R := Foo (123);                                                                                   function Foo (X: Integer)
                                                                                                                 return Float
                                                                                                               is
               Wait for reply                                                                                   …
                                                                                                               begin
                                                                                                                 …
                    Get result                                                                                   return …;
                                           send result or modified parameters                                  end Foo;




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

      • Remote procedure call completely handled by the
        system


      • Parameters and results passed across the
        network without programmer intervention


      • Heterogeneity handled transparently


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


                                                                                                 function Foo
                                                                                                    (X : Integer)
                                                                                                    return Float;




                       R := Foo (123);




                                                                                                                    30
http://libre.act-europe.fr               © ACT Europe under the GNU Free Documentation License
Client Stub & Server Skeleton
           • From the server spec the system generates a
             client stub:
                  –   Marshals the parameters
                  –   Sends the request over the network
                  –   Waits for the response and unmarshals the result
           • From the server spec (and server body) the
             system generates a server skeleton
                  –   Receives the RPC request
                  –   unmarshals the parameters
                  –   Selects and calls the appropriate subprogram
                  –   Marshals the result and sends the response
                                                                                           31
http://libre.act-europe.fr         © ACT Europe under the GNU Free Documentation License
Stubs & Skeletons
                                                                                                   function Foo (X: Integer)
                                                                                                      return Float
                                                                                                   is
                                            function Foo                                              …
                                               (X : Integer)                                       end Foo;
                                                                                                         Foo;

                                               return Float;




                              Special                                           Special
                             Compiler                                          Compiler




                             Client Stub                                   Server Skeleton


                                                                                                                               32
http://libre.act-europe.fr                 © ACT Europe under the GNU Free Documentation License
function Foo
                                                                                                      (X : Integer)
                                                                                                      return Float;


                             Client Stub                                        Server             function Foo (X: Integer)
                                                                                                      return Float
                                                                               Skeleton            is
       R := Foo (123);                                                                                …
                                                                                                   end Foo;
                                                                                                         Foo;




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

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


              Client                                                                                                Server
             Client                 Client Stub                                      Server Skeleton               Server
                             call          parameter
                                           marshalling
                                                                                                           call
                                                                           result
                                                                        unmarshalling                                 function Foo
                                                network                     result
                                                                          marshalling                     return
                                           result
                                        unmarshalling
                        return


                                                                                                                               34
http://libre.act-europe.fr                        © ACT Europe under the GNU Free Documentation License
Enhancing RPCs
           • Exceptions
                  – exceptions raised in the callee canbe transmitted to
                    the caller over the network
           • Asynchronous calls
                  – the caller does not need to wait for the result from the
                    callee (one way procedure calls)
           • Pointers on remote procedures
                  – RPC through a pointer. At the point of call the spec of
                    the callee is known but not its location or identity

                                                                                          35
http://libre.act-europe.fr        © ACT Europe under the GNU Free Documentation License
Service Related to RPCs:
                              Naming

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


           • This service is called via RPC

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


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

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

                                                     ?
           A: Alert’Class := Get_Alert;
           …
           Handle (A);
             Dynamic
             Binding
                               type Medium_Alert is new Alert...;
                               procedure Handle (A : in out Medium_Alert);




                                                                                                                    37
http://libre.act-europe.fr                © ACT Europe under the GNU Free Documentation License
• Introduction
                             • Distributed Prog. Paradigms
                             • Distributed Object Technologies
                               – Language Dependent: Ada 95
                               – Language Independent: CORBA




                                                                                               38
http://libre.act-europe.fr             © ACT Europe under the GNU Free Documentation License
Language Dependent
             Distributed Objects Paradigm

                                                                                                  spec




                             body



                              The same programming language is used to write
                                  • the spec of the distributed services
                                  • the implementation of the server code
                                  • the implementation of the client code
                                                                                                         39
http://libre.act-europe.fr                © ACT Europe under the GNU Free Documentation License
Language Independent
               Distributed Objects Paradigm
                                        language indep.
                                             spec
                                                                                                        spec
                                                                                                    language B




                                                                                                    Server
                             Client
                                                                                                    language B
                         language A



                               Different languages are used to write:
                                    • the spec of the distributed services
                                    • the implementation of the server code
                                    • the implementation of the client code
                                                                                                                 40
http://libre.act-europe.fr                  © ACT Europe under the GNU Free Documentation License
• Introduction
                             • Distributed Prog. Paradigms
                             • Distributed Object Technologies
                               – Language Dependent: Ada 95
                               – Language Independent: CORBA




                                                                                               41
http://libre.act-europe.fr             © ACT Europe under the GNU Free Documentation License
Ada 95
Distributed Systems Annex




                            42
Ada 95 Distributed
                                Programming


                                           Ada 95

                               Core                                Annex E

                             partition                      multi-partitions
                             (process)


          A partition comprises one or more Ada packages                                      43
http://libre.act-europe.fr            © ACT Europe under the GNU Free Documentation License
Supported Paradigms

           • Client/Server Paradigm (RPC)
                  – Synchronous / Asynchronous
                  – Static / Dynamic

           • Distributed Objects
           • Shared Memory




                                                                                          44
http://libre.act-europe.fr        © ACT Europe under the GNU Free Documentation License
Ada Distributed Application
           • No need for a separate interfacing language as
             in CORBA (IDL)
                  – Ada is the IDL


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


           • All packages except RCI & SP duplicated on
             partitions using them
                                                                                           45
http://libre.act-europe.fr         © ACT Europe under the GNU Free Documentation License
Remote_Call_Interface (RCI)


      • Allows subprograms to be called remotely

             – Statically bound RPCs

             – Dynamically bound RPCs
                (remote access to subprogram)



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

      • Allows the definition of a remote access types

             – Remote access to subprogram

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


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

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

           • Allows support of shared distributed memory

           • Allows persistence on some implementations



                                                                                       48
http://libre.act-europe.fr     © ACT Europe under the GNU Free Documentation License
Building a Distributed App in
                          Ada 95
       1. Write app as if non distributed.

       2. Identify remote procedures, shared variables, and
          distributed objects & categorize packages.

       3. Build & test non-distributed application.

       4. Write a configuration file for partitionning your app.

       5. Build partitions & test distributed app.
                                                                                                     pac
                                                                                                     kag
                                   pac                                                               eP
                                   kag                                                               is
                                                                                               package
                                   eP                                                                   .
                                                                                               P is
                                   is                                                                                              pac
                             package                                                                                  pac
                                                                                                 .
                                      .                                                                                            kag
                                              package
                             P is                                                                                     kag
                                                                                                                                   eP
                                              P is
                              .                                                                                       eP
                                                                                                                                   is
                                                .                                                                     is     package
                                    package                                                                     package
                                                                                                                                      .
                                                                                                                         .   P is
                                    P is                                                                        P is
                                                                                                                               .
                                      .                                                                          .




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

                                  An Example



                                                                                           50
http://libre.act-europe.fr         © ACT Europe under the GNU Free Documentation License
package Types is
        Write App                   type Device is (Furnace, Boiler,…);
                                    type Pressure is …;
                                    type Temperature is …;
                                  end Types;

                             with Types; use Types;
                              with Types; use Types;
                             package Sensors is
                              package Sensors is
                                function Get_P ((D:Device) return Pressure;
                                 function Get_P D: Device) return Pressure;
                                function Get_T ((D:Device) return Temperature;
                                 function Get_T D: Device) return Temperature;
                             end Sensors;
                              end Sensors;


       with Types; use Types;                                     with Types; use Types;
       with Sensors;                                              with Sensors;
       procedure Client_1 is                                      procedure Client_2 is
         P := Sensors.Get_P (Boiler);                               T := Sensors.Get_T (Furnace);51
http://libre.act-europe.fr            © ACT Europe under the GNU Free Documentation License
package Types is
      Categorize                    pragma Pure;
                                    type Device is (Furnace, Boiler,…);
                                    type Pressure is …;
                                    type Temperature is …;
                                  end Types;

                             with Types; use Types;
                              with Types; use Types;
                             package Sensors is
                              package Sensors is
                                pragma Remote_Call_Interface;
                                 pragma Remote_Call_Interface;
                                function Get_P (D:Device) return Pressure;
                                 function Get_P (D:Device) return Pressure;
                                function Get_T (D:Device) return Temperature;
                                 function Get_T (D:Device) return Temperature;
                             end Sensors;
                              end Sensors;

       with Types; use Types;                                     with Types; use Types;
       with Sensors;                                              with Sensors;
       procedure Client_1 is                                      procedure Client_2 is
         P := Sensors.Get_P (Boiler);                               T := Sensors.Get_T (Furnace);52
http://libre.act-europe.fr            © ACT Europe under the GNU Free Documentation License
package Types is
                                    pragma Pure;
       Build & Test
                                    type Device is (Furnace, Boiler,…);
                                    type Pressure is …;
                                    type Temperature is …;
                                  end Types;

                             with Types; use Types;
                              with Types; use Types;
                             package Sensors is
                              package Sensors is
                                pragma Remote_Call_Interface;
                                 pragma Remote_Call_Interface;
                                function Get_P (D:Device) return Pressure;
                                 function Get_P (D:Device) return Pressure;
                                function Get_T (D:Device) return Temperature;
                                 function Get_T (D:Device) return Temperature;
                             end Sensors;
                              end Sensors;

       with Types; use Types;
       with Sensors;
       procedure Client_1 is
         P := Sensors.Get_P (Boiler);                                                         53
http://libre.act-europe.fr            © ACT Europe under the GNU Free Documentation License
package Types is
                                    pragma Pure;
       Build & Test
                                    type Device is (Furnace, Boiler,…);
                                    type Pressure is …;
                                    type Temperature is …;
                                  end Types;

                             with Types; use Types;
                              with Types; use Types;
                             package Sensors is
                              package Sensors is
                                pragma Remote_Call_Interface;
                                 pragma Remote_Call_Interface;
                                function Get_P (D:Device) return Pressure;
                                 function Get_P (D:Device) return Pressure;
                                function Get_T (D:Device) return Temperature;
                                 function Get_T (D:Device) return Temperature;
                             end Sensors;
                              end Sensors;

                                                                  with Types; use Types;
                                                                  with Sensors;
                                                                  procedure Client_2 is
                                                                    T := Sensors.Get_T (Furnace);54
http://libre.act-europe.fr            © ACT Europe under the GNU Free Documentation License
Partition



                             configuration Config_1 is
                               Node_A : Partition := (Sensors);
                               Node_B : Partition := (Client_1);
                               Node_C : Partition := (Client_2);
                             end Config_1;




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




                                                                                     Node_A




                             Node_B                                         Node_C
                                                                                              56
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
package Types is
          pragma Pure;
          type Device is …;
          type Pressure is …;
          type Temperature is …;
        end Types;
                             DUPLICATED                                                Node_A




                              Node_B                                          Node_C
                                                                                                57
http://libre.act-europe.fr     © ACT Europe under the GNU Free Documentation License
with Types; use Types;
  with Types; use Types;
 package Sensors is
  package Sensors is
    pragma Remote_Call_Interface;
     pragma Remote_Call_Interface;
    function Get_P(…) return Pressure;
     function Get_P(…) return Pressure;
    function Get_T(…) return Temperature;
     function Get_T(…) return Temperature;
 end Sensors;
  end Sensors;
                                                                                     Node_A
                                         STUBS




                             Node_B                                         Node_C
                                                                                              58
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
with Types; use Types;
  with Types; use Types;
 package Sensors is
  package Sensors is
    pragma Remote_Call_Interface;
     pragma Remote_Call_Interface;
    function Get_P(…) return Pressure;
     function Get_P(…) return Pressure;
    function Get_T(…) return Temperature;
     function Get_T(…) return Temperature;
 end Sensors;
  end Sensors;
                                                                                     Node_A
                                   SKELETON
                                    + BODY




                             Node_B                                         Node_C
                                                                                              59
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
….:= Sensors.Get_P (Boiler);
                                                                         Sensors.Get_P body
            Sensors.Get_P Stub
            Sensors.Get_P Stub

             Marshal Arguments
             Marshal Arguments                                            Select body
                                                                          Select body        Skeleton
                                                                          Unmarshal Arguments
                                                                          Unmarshal Arguments

                             Send                             Receive
  Node_B                                                                                    Node_A




                                                                                                        60
http://libre.act-europe.fr          © ACT Europe under the GNU Free Documentation License
Asynchronous Calls
        with Types; use Types;
        package Sensors is
         pragma Remote_Call_Interface;
                  Remote_Call_Interface
         …
         procedure Log (D : Device; P : Pressure);
         pragma Asynchronous (Log);

        end Bank;


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

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

                              An Example



                                                                                       62
http://libre.act-europe.fr     © ACT Europe under the GNU Free Documentation License
package Alerts is
   Write App                     type Alert is abstract tagged private;
                                 type Alert_Ref is access all Alert’Class;
                                 procedure Handle (A : access Alert);
                                 procedure Log (A : access Alert) is abstract;
                              private
                                 ...
                             end Alerts;
  package Alerts.Pool is
     procedure Register (A : Alert_Ref);
     function Get_Alert return Alert_Ref;
  end Medium;                 with Alerts, Alerts.Pool; use Alerts;
                                        procedure Process_Alerts is
                                        begin
                                              loop
                                                   Handle (Pool.Get_Alert);
                                              end loop;
                                                                                       63
                                     © ACT Europe Process_Alerts;
                                        end under the GNU Free Documentation License
http://libre.act-europe.fr
package Alerts.Low is
                     type Low_Alert is new Alert with private;
                     procedure Log (A : access Low_Alert);
                 private
                     ...
                 end Alerts.Low;


                 with Alerts.Pool; use Alerts.Pool;
                 package body Alerts.Low is
                    ...
                 begin
                    Register (new Low_Alert);
                 end Alerts.Low;
                                                                                             64
http://libre.act-europe.fr           © ACT Europe under the GNU Free Documentation License
package Alerts.Medium is
                     type Medium_Alert is new Alert with private;
                     procedure Handle (A : access Medium_Alert);
                     procedure Log (A : access Medium_Alert);
                 private
                     ...
                 end Alerts.Medium;

                 with Alerts.Pool; use Alerts.Pool;
                 package body Alerts.Medium is
                    ...
                 begin
                    Register (new Medium_Alert);
                 end Alerts.Medium;
                                                                                             65
http://libre.act-europe.fr           © ACT Europe under the GNU Free Documentation License
package Alerts is
   Categorize                  pragma Remote_Types;
                                           Remote_Types
                               type Alert is abstract tagged private;
                               type Alert_Ref is access all Alert’Class;
                               procedure Handle (A : access Alert);
                               procedure Log (A : access Alert) is abstract;
                            private
   package Alerts.Pool is ...
                           end Alerts;
          pragma Remote_Call_Interface;
          procedure Register (A : Alert_Ref);
          function Get_Alert return Alert_Ref;
   end Medium;                         with Alerts, Alerts.Pool; use Alerts;
                                       procedure Process_Alerts is
                                       begin
                                             loop
                                                  Handle (Pool.Get_Alert);
                                             end loop;
                                                                                    66
                                    © ACT Europe Process_Alerts;
                                       end under the GNU Free Documentation License
http://libre.act-europe.fr
package Alerts.Low is
         pragma Remote_Types;
                 Remote_Types
         type Low_Alert is new Alert with private;
         procedure Log (A : access Low_Alert);
     private
         ...
     end Alerts.Low;

                             package Alerts.Medium is
                                 pragma Remote_Types;
                                         Remote_Types
                                 type Medium_Alert is new Alert with private;
                                 procedure Handle (A : access Medium_Alert);
                                 procedure Log (A : access Medium_Alert);
                             private
                                 ...
                             end Alerts.Medium;
                                                                                        67
http://libre.act-europe.fr      © ACT Europe under the GNU Free Documentation License
Build &              package Alerts is
                                pragma Remote_Types;
                                          Remote_Types

       Test                     type Alert is abstract tagged private;
                                type Alert_Ref is access all Alert’Class;
                                     Alert_                  Alert’Class;
                                procedure Handle (A : access Alert);
                                procedure Log (A : access Alert) is abstract;
                                                                        abstract;
                            private
                                ...                package Alerts.Low is
                           end Alerts;                 pragma Remote_Types;
                                                               Remote_Types
                                                       type Low_Alert is new Alert with private;
                                                       procedure Log (A : access Low_Alert);
                                                   private
                                                                             package Alerts.Medium is
                                                       ...
                                                                                 pragma Remote_Types;
                                                                                          Remote_Types
                                                   end Alerts.Low;
                                                                                 type Medium_Alert is new Alert with private;
                                                                                 procedure Handle (A : access Medium_Alert);
                                                                                 procedure Log (A : access Medium_Alert);
   package Alerts.Pool is
                                                                             private
      pragma Remote_Call_Interface;
              Remote_Call_Interface;
                                                                                 ...
      procedure Register (A : Alert_Ref);
                                                                             end Alerts.Medium;
                                                                                  Alerts.
      function Get_Alert return Alert_Ref;
   end Medium;



                                     with Alerts, Alerts.Pool; use Alerts;
                                     procedure Process_Alerts is
                                     begin
                                        loop
                                           Handle (Pool.Get_Alert);
                                        end loop;
                                                                                                                                68
                                     end Process_Alerts;
http://libre.act-europe.fr                       © ACT Europe under the GNU Free Documentation License
Partition



                             configuration Config_2 is
                               Node_AL : Partition := (Alerts.Low);
                               Node_AM : Partition := (Alerts.Medium);
                               Node_B : Partition := (Alerts.Pool);
                               Node_C : Partition := (Process_Alerts);
                             end Config_2;




                                                                                         69
http://libre.act-europe.fr       © ACT Europe under the GNU Free Documentation License
What Happens
                         When Executing
                    the Distributed Program ?




                                                                                     70
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
package Alerts.Low is                                                   package Alerts.Medium is
          pragma Remote_Types;                                                    pragma Remote_Types;
                  Remote_Types                                                             Remote_Types
          type Low_Alert is new Alert with private;                               type Medium_Alert is new Alert with private;
          procedure Log (A : access Low_Alert);                                   procedure Handle (A : access Medium_Alert);
      private                                                                     procedure Log (A : access Medium_Alert);
          ...                                                                 private
      end Alerts.Low;                                                             ...
                                                                              end Alerts.Medium;
                                                                                   Alerts.

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


                                                                                       with Alerts, Alerts.Pool; use Alerts;
                                                                                       procedure Process_Alerts is
      package Alerts.Pool is
                                                                                       begin
         pragma Remote_Call_Interface;
                 Remote_Call_Interface;
                                                                                          loop
         procedure Register (A : Alert_Ref);
                                                                                             Handle (Pool.Get_Alert);
         function Get_Alert return Alert_Ref;
                                                                                          end loop;
      end Medium;
                                                                                       end Process_Alerts;


                         Node_B                                                        Node_C
                                                                                                                                 71
http://libre.act-europe.fr                        © ACT Europe under the GNU Free Documentation License
package Alerts.Low is                                                   package Alerts.Medium is
          pragma Remote_Types;                                                    pragma Remote_Types;
                  Remote_Types                                                             Remote_Types
          type Low_Alert is new Alert with private;                               type Medium_Alert is new Alert with private;
          procedure Log (A : access Low_Alert);                                   procedure Handle (A : access Medium_Alert);
      private                                                                     procedure Log (A : access Medium_Alert);
          ...                                                                 private
      end Alerts.Low;                                                             ...
                                                                              end Alerts.Medium;
                                                                                   Alerts.

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


                                                                                       with Alerts, Alerts.Pool; use Alerts;
                                                                                       procedure Process_Alerts is
      package Alerts.Pool is
                                                                                       begin
         pragma Remote_Call_Interface;
                 Remote_Call_Interface;
                                                                                          loop
         procedure Register (A : Alert_Ref);
                                                                                             Handle (Pool.Get_Alert);
         function Get_Alert return Alert_Ref;
                                                                                          end loop;
      end Medium;
                                                                                       end Process_Alerts;


                         Node_B                                                        Node_C
                                                                                                                                 72
http://libre.act-europe.fr                        © ACT Europe under the GNU Free Documentation License
package Alerts.Low is                                                   package Alerts.Medium is
          pragma Remote_Types;                                                    pragma Remote_Types;
                  Remote_Types                                                             Remote_Types
          type Low_Alert is new Alert with private;                               type Medium_Alert is new Alert with private;
          procedure Log (A : access Low_Alert);                                   procedure Handle (A : access Medium_Alert);
      private                                                                     procedure Log (A : access Medium_Alert);
          ...                                                                 private
      end Alerts.Low;                                                             ...
                                                                              end Alerts.Medium;
                                                                                   Alerts.

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


                                                                                       with Alerts, Alerts.Pool; use Alerts;
                                                                                       procedure Process_Alerts is
      package Alerts.Pool is
                                                                                       begin
         pragma Remote_Call_Interface;
                 Remote_Call_Interface;
                                                                                          loop
         procedure Register (A : Alert_Ref);
                                                                                             Handle (Pool.Get_Alert);
         function Get_Alert return Alert_Ref;
                                                                                          end loop;
      end Medium;
                                                                                       end Process_Alerts;


                         Node_B                                                        Node_C
                                                                                                                                 73
http://libre.act-europe.fr                        © ACT Europe under the GNU Free Documentation License
package Alerts.Low is                                                   package Alerts.Medium is
          pragma Remote_Types;                                                    pragma Remote_Types;
                  Remote_Types                                                             Remote_Types
          type Low_Alert is new Alert with private;                               type Medium_Alert is new Alert with private;
          procedure Log (A : access Low_Alert);                                   procedure Handle (A : access Medium_Alert);
      private                                                                     procedure Log (A : access Medium_Alert);
          ...                                                                 private
      end Alerts.Low;                                                             ...
                                                                              end Alerts.Medium;
                                                                                   Alerts.

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


                                                                                       with Alerts, Alerts.Pool; use Alerts;
                                                                                       procedure Process_Alerts is
      package Alerts.Pool is
                                                                                       begin
         pragma Remote_Call_Interface;
                 Remote_Call_Interface;
                                                                                          loop
         procedure Register (A : Alert_Ref);
                                                                                             Handle (Pool.Get_Alert);
         function Get_Alert return Alert_Ref;
                                                                                          end loop;
      end Medium;
                                                                                       end Process_Alerts;


                         Node_B                                                        Node_C
                                                                                                                                 74
http://libre.act-europe.fr                        © ACT Europe under the GNU Free Documentation License
package Alerts.Low is                                                   package Alerts.Medium is
          pragma Remote_Types;                                                    pragma Remote_Types;
                  Remote_Types                                                             Remote_Types
          type Low_Alert is new Alert with private;                               type Medium_Alert is new Alert with private;
          procedure Log (A : access Low_Alert);                                   procedure Handle (A : access Medium_Alert);
      private                                                                     procedure Log (A : access Medium_Alert);
          ...                                                                 private
      end Alerts.Low;                                                             ...
                                                                              end Alerts.Medium;
                                                                                   Alerts.



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


                                                                                       with Alerts, Alerts.Pool; use Alerts;
                                                                                       procedure Process_Alerts is
      package Alerts.Pool is
                                                                                       begin
         pragma Remote_Call_Interface;
                 Remote_Call_Interface;
                                                                                          loop
         procedure Register (A : Alert_Ref);
                                                                                             Handle (Pool.Get_Alert);
         function Get_Alert return Alert_Ref;
                                                                                          end loop;
      end Medium;
                                                                                       end Process_Alerts;


                         Node_B                                                        Node_C
                                                                                                                                 75
http://libre.act-europe.fr                        © ACT Europe under the GNU Free Documentation License
What Does Get_Alert Return ?


                             Pointer
         Get_Alert




                                                                                      Address of
                                                                                      Alert object
                                                                       Machine
                                                                                        on the
                                                                                       Machine

                                                                                                 76
http://libre.act-europe.fr    © ACT Europe under the GNU Free Documentation License
Remote Access to Class Wide Type


     • At compile time:

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

            – On what node that operations will be
              executed on


                                                                                     77
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
• Introduction
                             • Distributed Prog. Paradigms
                             • Distributed Object Technologies
                               – Language Dependent: Ada 95
                               – Language Independent: CORBA




                                                                                               78
http://libre.act-europe.fr             © ACT Europe under the GNU Free Documentation License
Language Independent
               Distributed Objects Paradigm
                                        language indep.
                                          Spec (IDL)
                                                                                                        spec
                                                                                                    language B




                                                                                                    Server
                             Client
                                                                                                    language B
                         language A



                               Different languages are used to write:
                                    • the spec of the distributed services
                                    • the implementation of the server code
                                    • the implementation of the client code
                                                                                                                 79
http://libre.act-europe.fr                  © ACT Europe under the GNU Free Documentation License
CORBA Interfaces
           • In Corba interfaces are described in IDL
                  – (Interface Description Language)
           • The IDL is independent of programming languages
           • Each interface is translated in
                  – Language A used for the client (client stub)
                  – Language B used for the server (server skeleton)
           • To implement the server the programmer completes
             the skeleton in language B
           • To implement the client the programmer uses the
             services provided by th estub in language A


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

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


           • The ORB is a software bus

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

                                                                                         81
http://libre.act-europe.fr       © ACT Europe under the GNU Free Documentation License
The IDL
  • Syntax similar to C++ with some Ada additions
  • IDL must be translatable in various prog. Languages
         – Ada, C, C++, Java, …
  • There are limitations in what you can write in the IDL
  • Programmer must understand how the IDL is
    translated in the host language
         – to complete the server skeleton
         – to use the client stub

                                                                                      82
http://libre.act-europe.fr    © ACT Europe under the GNU Free Documentation License
Example
                        module M {
                           interface T {
                              void P ();
                           };
                        };

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

                                                                                                   83
http://libre.act-europe.fr                 © ACT Europe under the GNU Free Documentation License
Exemple
           module Echo {
              string echoString (in string mesg);
           };


            Module foo {
                 interface Buffer {
                       exception Empty;
                       void put (in string content);
                       string get() raises (Empty);
                 }
                                                                                         84
            };
http://libre.act-europe.fr       © ACT Europe under the GNU Free Documentation License
Example 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 echoString (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;
                                                           85
http://libre.act-europe.fr   © ACT Europe under the GNU Free Documentation License
CORBA Services

           • The CORBA core services are very few

           • Lot ’s of external services
                  –   Naming (distributed and hierarchical)
                  –   Persistance
                  –   Transaction
                  –   Security
                  –   ...


                                                                                            86
http://libre.act-europe.fr          © ACT Europe under the GNU Free Documentation License
Common
                             Application
  Code you
  Code you                                                                                     Domain
                                                                                  Facilities   Domain
                              Objects
   write
    write                                                                                      Specific
                                                                                               Specifi



                                                         OR B



  Domain
  Domain
Independent
Independent                                Object Services




                                                                                                87
http://libre.act-europe.fr          © ACT Europe under the GNU Free Documentation License
• Introduction
                             • Distributed Prog. Paradigms
                             • Distributed Object Technologies
                             • Conclusion



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

           • Using network services directly
                  – Sockets

                                                                                         Similar issues
           • Using middleware
                                                                                              with
                  – CORBA
                                                                                            Tasking
                  – COM/DCOM


           • Using a distributed language
                  – Ada 95 DSA
                  – Java RMI

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

                  General
                  Design

                             Distributed
                               Design


                                                      Coding


                                                                                    Testing

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

                  General                                              Ad Hoc
                  Design

                             Distributed                                            Very low level
                               Design

                                                                                              Distributed
                                                      Coding                                  mode only


                                                                                    Testing

                                                                                                            91
http://libre.act-europe.fr        © ACT Europe under the GNU Free Documentation License
•     Everything must be done with sockets
         •     Data marshaling/unmarshalling
         •     Handle heterogeneous systems directly




                                                                                 Very low level



                                                   Coding




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

                  General                                                  IDL
                  Design

                                                                                   Must invoke high-level
                             Distributed
                                                                                     services directly
                               Design

                                                                                              Distributed
                                                      Coding                                  mode only


                                                                                    Testing

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

                  General                                              Ada 95
                  Design

                                                                                          Regular Ada
                             Distributed
                                                                                            Coding
                               Design

                                                                                                distributed
                                                      Coding                                 & non-distributed


                                                                                    Testing

                                                                                                          94
http://libre.act-europe.fr        © ACT Europe under the GNU Free Documentation License
Ada 95 DSA & CORBA:
                                   Benefits

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

         • Raise the level of abstraction




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

Mais conteúdo relacionado

Mais de Gneuromante canalada.org (8)

Ada 95 - Object orientation
Ada 95 - Object orientationAda 95 - Object orientation
Ada 95 - Object orientation
 
Ada 95 - Structured programming
Ada 95 - Structured programmingAda 95 - Structured programming
Ada 95 - Structured programming
 
Ada 95 - Introduction
Ada 95 - IntroductionAda 95 - Introduction
Ada 95 - Introduction
 
Ada 95 - Generics
Ada 95 - GenericsAda 95 - Generics
Ada 95 - Generics
 
Developing Software That Matters I
Developing Software That Matters IDeveloping Software That Matters I
Developing Software That Matters I
 
Developing Software that Matters II
Developing Software that Matters IIDeveloping Software that Matters II
Developing Software that Matters II
 
Introduction to Ada
Introduction to AdaIntroduction to Ada
Introduction to Ada
 
Ada in Debian GNU/Linux
Ada in Debian GNU/LinuxAda in Debian GNU/Linux
Ada in Debian GNU/Linux
 

Último

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 

Último (20)

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 

Ada 95 - Distributed systems

  • 1. Franco Gasperoni gasperon@act-europe.fr http://libre.act-europe.fr 1 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 2. Copyright Notice • © ACT Europe under the GNU Free Documentation License • Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; provided its original author is mentioned 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: • http://www.fsf.org/licenses/fdl.html 2 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 3. 3 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 4. • Introduction • Distributed Prog. Paradigms • Distributed Object Technologies • Conclusion 4 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 5. • Non-distributed application = single process – running on a single computer • Distributed application = several communicating processes – processes often run on different computers – computers are connected through a network 5 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 6. Single Process Application spec body spec main body spec process body 6 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 7. Distributed Application spec body spec main spec body spec body process spec body main body spec process body spec body Application spec main body spec process body 7 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 8. All Processes Can Run on the Same Computer spec body spec main spec body spec body process spec body main body spec process body spec body spec main body spec process body 8 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 9. Or They can run on Different Computers spec body spec main body spec process spec body body spec main body spec process body spec body spec main body spec process body 9 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 10. In All Cases This Requires Inter-Process Communication spec body spec main spec body spec body process spec body main body spec process body spec body spec main body spec process body 10 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 11. spec body spec main ? body spec process spec body body spec main body ? spec process body spec body spec main body spec process body 11 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 12. The Main Topic of this Lecture • How distributed processes communicate at the programming level • How the “software chunks” of a distributed app can interact. • This lecture will NOT teach you how they communicate at the – physical level – or protocol level 12 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 13. Remember OSI Layers ? } { Application Application This is what Presentation Presentation we will look at Session Session Transport Transport Network Network Data Link Data Link Physical Physical 13 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 14. Telnet, ftp, … Application Sending data in platform indep. manner Presentation Establish communication bw processes Session TCP, UDP, ... Transport Network IP, X.25, ... Data Link Network drivers Physical The wire 14 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 15. Why Distributed Apps ? • Multiuser apps (e.g. e-mail, ftp) • Sharing data (e.g. www, airline reservation) • Sharing resources (e.g. printers) • Fault tolerance • App may be inherently distributed (cell phones, ATM machines, …) 15 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 16. Distributed Prog. Is Hard • Multiple failure modes – each individual process can fail (bugs, machine crash..) – the network can go ashtray • Security issues – is someone else listening • Testing & debugging • Distributed prog. technologies not fully mature – interoperability is still an issue 16 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 17. • Introduction • Distributed Prog. Paradigms – Message Sending (Sockets) – Remote Procedure Calls – Distributed Objects 17 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 18. How to Formalize the Notion of an Interface in a Distributed Environment ? ? spec body process process 18 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 19. How to Formalize the Notion of an Interface in a Distributed Environment ? • Answer 1: don’t formalize it, send a message – e.g. sockets • Answer 2: Remote Procedure Call (RPC) • Answer 3: RPCs + Distributed Objects – Language dependent: Ada 95, Java RMI – Language independent: CORBA, COM/DCOM 19 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 20. A Simple Comparison Programming with Message Sending GOTOs (sockets) Structured RPCs Programming Object-Oriented Distributed Objects Programming 20 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 21. Some Terminology spec body Client: the code that made Server: the code that the request for service answered the request 21 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 22. Answer 1: Don’t Formalize It Send a Message (e.g. Sockets) Send (…, Bytes); Receive (…, & Bytes [ ]); 22 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 23. Client Process Server Process Client Process Server Process Open socket Open socket Wait for connection Compute raw bytes Send bytes Get bytes Wait for reply Compute Send bytes Get bytes raw bytes Close socket Close socket 23 time time http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 24. What are the problems with this approach ? 24 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 25. Problems with Sockets/Message Sending • No interfaces - very low-level programming – does not scale up • Sockets exchange bytes – How do you exchange more complex data structures ? – How do you handle heterogeneous systems ? 25 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 26. Client Server Client Server Doesn’t this look familiar ? Compute Wait for request data Send request Answer request Wait for reply Compute Send response Get response data 26 time time http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 27. Answer 2: Remote Procedure Calls function Foo (X : Integer) return Float; R := Foo (123); 27 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 28. Client Server Client Server RPC Compute send parameters R := Foo (123); function Foo (X: Integer) return Float is Wait for reply … begin … Get result return …; send result or modified parameters end Foo; 28 time time http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 29. RPCs • Remote procedure call completely handled by the system • Parameters and results passed across the network without programmer intervention • Heterogeneity handled transparently 29 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 30. Where is the Magic ? function Foo (X : Integer) return Float; R := Foo (123); 30 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 31. Client Stub & Server Skeleton • From the server spec the system generates a client stub: – Marshals the parameters – Sends the request over the network – Waits for the response and unmarshals the result • From the server spec (and server body) the system generates a server skeleton – Receives the RPC request – unmarshals the parameters – Selects and calls the appropriate subprogram – Marshals the result and sends the response 31 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 32. Stubs & Skeletons function Foo (X: Integer) return Float is function Foo … (X : Integer) end Foo; Foo; return Float; Special Special Compiler Compiler Client Stub Server Skeleton 32 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 33. function Foo (X : Integer) return Float; Client Stub Server function Foo (X: Integer) return Float Skeleton is R := Foo (123); … end Foo; Foo; 33 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 34. Client Server Client Server call function Foo (X : Integer) return Float is ... network return Client Server Client Client Stub Server Skeleton Server call parameter marshalling call result unmarshalling function Foo network result marshalling return result unmarshalling return 34 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 35. Enhancing RPCs • Exceptions – exceptions raised in the callee canbe transmitted to the caller over the network • Asynchronous calls – the caller does not need to wait for the result from the callee (one way procedure calls) • Pointers on remote procedures – RPC through a pointer. At the point of call the spec of the callee is known but not its location or identity 35 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 36. Service Related to RPCs: Naming • Records the location of the various processes – location of client stubs and server skeletons • This service is called via RPC • To solve the circularity problem the naming service is at a known machine address 36 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 37. Answer 3: Distributed Objects type Alert is tagged record…; procedure Handle (A : in out Alert); ? A: Alert’Class := Get_Alert; … Handle (A); Dynamic Binding type Medium_Alert is new Alert...; procedure Handle (A : in out Medium_Alert); 37 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 38. • Introduction • Distributed Prog. Paradigms • Distributed Object Technologies – Language Dependent: Ada 95 – Language Independent: CORBA 38 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 39. Language Dependent Distributed Objects Paradigm spec body The same programming language is used to write • the spec of the distributed services • the implementation of the server code • the implementation of the client code 39 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 40. Language Independent Distributed Objects Paradigm language indep. spec spec language B Server Client language B language A Different languages are used to write: • the spec of the distributed services • the implementation of the server code • the implementation of the client code 40 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 41. • Introduction • Distributed Prog. Paradigms • Distributed Object Technologies – Language Dependent: Ada 95 – Language Independent: CORBA 41 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 43. Ada 95 Distributed Programming Ada 95 Core Annex E partition multi-partitions (process) A partition comprises one or more Ada packages 43 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 44. Supported Paradigms • Client/Server Paradigm (RPC) – Synchronous / Asynchronous – Static / Dynamic • Distributed Objects • Shared Memory 44 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 45. Ada Distributed Application • No need for a separate interfacing language as in CORBA (IDL) – Ada is the IDL • Some packages categorized using pragmas – Remote_Call_Interface (RCI) – Remote_Types – Shared_Passive (SP) • All packages except RCI & SP duplicated on partitions using them 45 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 46. Remote_Call_Interface (RCI) • Allows subprograms to be called remotely – Statically bound RPCs – Dynamically bound RPCs (remote access to subprogram) 46 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 47. Remote_Types • Allows the definition of a remote access types – Remote access to subprogram – Remote reference to objects (ability to do dynamically dispatching calls across the network) 47 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 48. Shared_Passive • A Shared_Passive package contains variables that can be accessed from distinct partitions • Allows support of shared distributed memory • Allows persistence on some implementations 48 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 49. Building a Distributed App in Ada 95 1. Write app as if non distributed. 2. Identify remote procedures, shared variables, and distributed objects & categorize packages. 3. Build & test non-distributed application. 4. Write a configuration file for partitionning your app. 5. Build partitions & test distributed app. pac kag pac eP kag is package eP . P is is pac package pac . . kag package P is kag eP P is . eP is . is package package package . . P is P is P is . . . 49 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 50. Remote_Call_Interface An Example 50 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 51. package Types is Write App type Device is (Furnace, Boiler,…); type Pressure is …; type Temperature is …; end Types; with Types; use Types; with Types; use Types; package Sensors is package Sensors is function Get_P ((D:Device) return Pressure; function Get_P D: Device) return Pressure; function Get_T ((D:Device) return Temperature; function Get_T D: Device) return Temperature; end Sensors; end Sensors; with Types; use Types; with Types; use Types; with Sensors; with Sensors; procedure Client_1 is procedure Client_2 is P := Sensors.Get_P (Boiler); T := Sensors.Get_T (Furnace);51 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 52. package Types is Categorize pragma Pure; type Device is (Furnace, Boiler,…); type Pressure is …; type Temperature is …; end Types; with Types; use Types; with Types; use Types; package Sensors is package Sensors is pragma Remote_Call_Interface; pragma Remote_Call_Interface; function Get_P (D:Device) return Pressure; function Get_P (D:Device) return Pressure; function Get_T (D:Device) return Temperature; function Get_T (D:Device) return Temperature; end Sensors; end Sensors; with Types; use Types; with Types; use Types; with Sensors; with Sensors; procedure Client_1 is procedure Client_2 is P := Sensors.Get_P (Boiler); T := Sensors.Get_T (Furnace);52 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 53. package Types is pragma Pure; Build & Test type Device is (Furnace, Boiler,…); type Pressure is …; type Temperature is …; end Types; with Types; use Types; with Types; use Types; package Sensors is package Sensors is pragma Remote_Call_Interface; pragma Remote_Call_Interface; function Get_P (D:Device) return Pressure; function Get_P (D:Device) return Pressure; function Get_T (D:Device) return Temperature; function Get_T (D:Device) return Temperature; end Sensors; end Sensors; with Types; use Types; with Sensors; procedure Client_1 is P := Sensors.Get_P (Boiler); 53 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 54. package Types is pragma Pure; Build & Test type Device is (Furnace, Boiler,…); type Pressure is …; type Temperature is …; end Types; with Types; use Types; with Types; use Types; package Sensors is package Sensors is pragma Remote_Call_Interface; pragma Remote_Call_Interface; function Get_P (D:Device) return Pressure; function Get_P (D:Device) return Pressure; function Get_T (D:Device) return Temperature; function Get_T (D:Device) return Temperature; end Sensors; end Sensors; with Types; use Types; with Sensors; procedure Client_2 is T := Sensors.Get_T (Furnace);54 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 55. Partition configuration Config_1 is Node_A : Partition := (Sensors); Node_B : Partition := (Client_1); Node_C : Partition := (Client_2); end Config_1; 55 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 56. Partition Node_A Node_B Node_C 56 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 57. package Types is pragma Pure; type Device is …; type Pressure is …; type Temperature is …; end Types; DUPLICATED Node_A Node_B Node_C 57 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 58. with Types; use Types; with Types; use Types; package Sensors is package Sensors is pragma Remote_Call_Interface; pragma Remote_Call_Interface; function Get_P(…) return Pressure; function Get_P(…) return Pressure; function Get_T(…) return Temperature; function Get_T(…) return Temperature; end Sensors; end Sensors; Node_A STUBS Node_B Node_C 58 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 59. with Types; use Types; with Types; use Types; package Sensors is package Sensors is pragma Remote_Call_Interface; pragma Remote_Call_Interface; function Get_P(…) return Pressure; function Get_P(…) return Pressure; function Get_T(…) return Temperature; function Get_T(…) return Temperature; end Sensors; end Sensors; Node_A SKELETON + BODY Node_B Node_C 59 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 60. ….:= Sensors.Get_P (Boiler); Sensors.Get_P body Sensors.Get_P Stub Sensors.Get_P Stub Marshal Arguments Marshal Arguments Select body Select body Skeleton Unmarshal Arguments Unmarshal Arguments Send Receive Node_B Node_A 60 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 61. Asynchronous Calls with Types; use Types; package Sensors is pragma Remote_Call_Interface; Remote_Call_Interface … procedure Log (D : Device; P : Pressure); pragma Asynchronous (Log); end Bank; + returns immediately + exceptions are lost + parameters must be in 61 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 62. Remote_Types An Example 62 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 63. package Alerts is Write App type Alert is abstract tagged private; type Alert_Ref is access all Alert’Class; procedure Handle (A : access Alert); procedure Log (A : access Alert) is abstract; private ... end Alerts; package Alerts.Pool is procedure Register (A : Alert_Ref); function Get_Alert return Alert_Ref; end Medium; with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is begin loop Handle (Pool.Get_Alert); end loop; 63 © ACT Europe Process_Alerts; end under the GNU Free Documentation License http://libre.act-europe.fr
  • 64. package Alerts.Low is type Low_Alert is new Alert with private; procedure Log (A : access Low_Alert); private ... end Alerts.Low; with Alerts.Pool; use Alerts.Pool; package body Alerts.Low is ... begin Register (new Low_Alert); end Alerts.Low; 64 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 65. package Alerts.Medium is type Medium_Alert is new Alert with private; procedure Handle (A : access Medium_Alert); procedure Log (A : access Medium_Alert); private ... end Alerts.Medium; with Alerts.Pool; use Alerts.Pool; package body Alerts.Medium is ... begin Register (new Medium_Alert); end Alerts.Medium; 65 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 66. package Alerts is Categorize pragma Remote_Types; Remote_Types type Alert is abstract tagged private; type Alert_Ref is access all Alert’Class; procedure Handle (A : access Alert); procedure Log (A : access Alert) is abstract; private package Alerts.Pool is ... end Alerts; pragma Remote_Call_Interface; procedure Register (A : Alert_Ref); function Get_Alert return Alert_Ref; end Medium; with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is begin loop Handle (Pool.Get_Alert); end loop; 66 © ACT Europe Process_Alerts; end under the GNU Free Documentation License http://libre.act-europe.fr
  • 67. package Alerts.Low is pragma Remote_Types; Remote_Types type Low_Alert is new Alert with private; procedure Log (A : access Low_Alert); private ... end Alerts.Low; package Alerts.Medium is pragma Remote_Types; Remote_Types type Medium_Alert is new Alert with private; procedure Handle (A : access Medium_Alert); procedure Log (A : access Medium_Alert); private ... end Alerts.Medium; 67 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 68. Build & package Alerts is pragma Remote_Types; Remote_Types Test type Alert is abstract tagged private; type Alert_Ref is access all Alert’Class; Alert_ Alert’Class; procedure Handle (A : access Alert); procedure Log (A : access Alert) is abstract; abstract; private ... package Alerts.Low is end Alerts; pragma Remote_Types; Remote_Types type Low_Alert is new Alert with private; procedure Log (A : access Low_Alert); private package Alerts.Medium is ... pragma Remote_Types; Remote_Types end Alerts.Low; type Medium_Alert is new Alert with private; procedure Handle (A : access Medium_Alert); procedure Log (A : access Medium_Alert); package Alerts.Pool is private pragma Remote_Call_Interface; Remote_Call_Interface; ... procedure Register (A : Alert_Ref); end Alerts.Medium; Alerts. function Get_Alert return Alert_Ref; end Medium; with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is begin loop Handle (Pool.Get_Alert); end loop; 68 end Process_Alerts; http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 69. Partition configuration Config_2 is Node_AL : Partition := (Alerts.Low); Node_AM : Partition := (Alerts.Medium); Node_B : Partition := (Alerts.Pool); Node_C : Partition := (Process_Alerts); end Config_2; 69 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 70. What Happens When Executing the Distributed Program ? 70 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 71. package Alerts.Low is package Alerts.Medium is pragma Remote_Types; pragma Remote_Types; Remote_Types Remote_Types type Low_Alert is new Alert with private; type Medium_Alert is new Alert with private; procedure Log (A : access Low_Alert); procedure Handle (A : access Medium_Alert); private procedure Log (A : access Medium_Alert); ... private end Alerts.Low; ... end Alerts.Medium; Alerts. Node_AL Node_AM Step 1: A Low_Alert object in Node_AL registers itself with Node_B with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is package Alerts.Pool is begin pragma Remote_Call_Interface; Remote_Call_Interface; loop procedure Register (A : Alert_Ref); Handle (Pool.Get_Alert); function Get_Alert return Alert_Ref; end loop; end Medium; end Process_Alerts; Node_B Node_C 71 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 72. package Alerts.Low is package Alerts.Medium is pragma Remote_Types; pragma Remote_Types; Remote_Types Remote_Types type Low_Alert is new Alert with private; type Medium_Alert is new Alert with private; procedure Log (A : access Low_Alert); procedure Handle (A : access Medium_Alert); private procedure Log (A : access Medium_Alert); ... private end Alerts.Low; ... end Alerts.Medium; Alerts. Node_AL Node_AM Step 2: A Medium_Alert object in Node_AM registers itself with Node_B with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is package Alerts.Pool is begin pragma Remote_Call_Interface; Remote_Call_Interface; loop procedure Register (A : Alert_Ref); Handle (Pool.Get_Alert); function Get_Alert return Alert_Ref; end loop; end Medium; end Process_Alerts; Node_B Node_C 72 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 73. package Alerts.Low is package Alerts.Medium is pragma Remote_Types; pragma Remote_Types; Remote_Types Remote_Types type Low_Alert is new Alert with private; type Medium_Alert is new Alert with private; procedure Log (A : access Low_Alert); procedure Handle (A : access Medium_Alert); private procedure Log (A : access Medium_Alert); ... private end Alerts.Low; ... end Alerts.Medium; Alerts. Node_AL Node_AM Step 3: Process_Alerts in Node_C does an RPC to Get_Alert in Node_B with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is package Alerts.Pool is begin pragma Remote_Call_Interface; Remote_Call_Interface; loop procedure Register (A : Alert_Ref); Handle (Pool.Get_Alert); function Get_Alert return Alert_Ref; end loop; end Medium; end Process_Alerts; Node_B Node_C 73 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 74. package Alerts.Low is package Alerts.Medium is pragma Remote_Types; pragma Remote_Types; Remote_Types Remote_Types type Low_Alert is new Alert with private; type Medium_Alert is new Alert with private; procedure Log (A : access Low_Alert); procedure Handle (A : access Medium_Alert); private procedure Log (A : access Medium_Alert); ... private end Alerts.Low; ... end Alerts.Medium; Alerts. Node_AL Node_AM Step 4: Get_Alert returns a pointer to an Alert object (Low_Alert or Medium_Alert) with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is package Alerts.Pool is begin pragma Remote_Call_Interface; Remote_Call_Interface; loop procedure Register (A : Alert_Ref); Handle (Pool.Get_Alert); function Get_Alert return Alert_Ref; end loop; end Medium; end Process_Alerts; Node_B Node_C 74 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 75. package Alerts.Low is package Alerts.Medium is pragma Remote_Types; pragma Remote_Types; Remote_Types Remote_Types type Low_Alert is new Alert with private; type Medium_Alert is new Alert with private; procedure Log (A : access Low_Alert); procedure Handle (A : access Medium_Alert); private procedure Log (A : access Medium_Alert); ... private end Alerts.Low; ... end Alerts.Medium; Alerts. ? Node_AL Node_AM Step 5: Node_C performs a dispatching RPC. It calls Handle in Node_AL or Node_AM with Alerts, Alerts.Pool; use Alerts; procedure Process_Alerts is package Alerts.Pool is begin pragma Remote_Call_Interface; Remote_Call_Interface; loop procedure Register (A : Alert_Ref); Handle (Pool.Get_Alert); function Get_Alert return Alert_Ref; end loop; end Medium; end Process_Alerts; Node_B Node_C 75 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 76. What Does Get_Alert Return ? Pointer Get_Alert Address of Alert object Machine on the Machine 76 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 77. Remote Access to Class Wide Type • At compile time: – You do not know what operation you’ll dispatch to – On what node that operations will be executed on 77 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 78. • Introduction • Distributed Prog. Paradigms • Distributed Object Technologies – Language Dependent: Ada 95 – Language Independent: CORBA 78 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 79. Language Independent Distributed Objects Paradigm language indep. Spec (IDL) spec language B Server Client language B language A Different languages are used to write: • the spec of the distributed services • the implementation of the server code • the implementation of the client code 79 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 80. CORBA Interfaces • In Corba interfaces are described in IDL – (Interface Description Language) • The IDL is independent of programming languages • Each interface is translated in – Language A used for the client (client stub) – Language B used for the server (server skeleton) • To implement the server the programmer completes the skeleton in language B • To implement the client the programmer uses the services provided by th estub in language A 80 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 81. The CORBA Architecture • RPC go through the ORB – (Object Request Broker) • The ORB is a software bus • ORBs communicate with a set of standardised protocols – IIOP, GIOP 81 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 82. The IDL • Syntax similar to C++ with some Ada additions • IDL must be translatable in various prog. Languages – Ada, C, C++, Java, … • There are limitations in what you can write in the IDL • Programmer must understand how the IDL is translated in the host language – to complete the server skeleton – to use the client stub 82 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 83. Example module M { interface T { void P (); }; }; package M is pragma Remote_Types; type T is tagged …; procedure P (O : in access T); end M; 83 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 84. Exemple module Echo { string echoString (in string mesg); }; Module foo { interface Buffer { exception Empty; void put (in string content); string get() raises (Empty); } 84 }; http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 85. Example 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 echoString (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; 85 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 86. CORBA Services • The CORBA core services are very few • Lot ’s of external services – Naming (distributed and hierarchical) – Persistance – Transaction – Security – ... 86 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 87. Common Application Code you Code you Domain Facilities Domain Objects write write Specific Specifi OR B Domain Domain Independent Independent Object Services 87 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 88. • Introduction • Distributed Prog. Paradigms • Distributed Object Technologies • Conclusion 88 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 89. Developing a Distributed App • Using network services directly – Sockets Similar issues • Using middleware with – CORBA Tasking – COM/DCOM • Using a distributed language – Ada 95 DSA – Java RMI 89 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 90. Impact on Development Phases General Design Distributed Design Coding Testing 90 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 91. Sockets General Ad Hoc Design Distributed Very low level Design Distributed Coding mode only Testing 91 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 92. Everything must be done with sockets • Data marshaling/unmarshalling • Handle heterogeneous systems directly Very low level Coding 92 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 93. CORBA General IDL Design Must invoke high-level Distributed services directly Design Distributed Coding mode only Testing 93 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 94. Ada 95 DSA General Ada 95 Design Regular Ada Distributed Coding Design distributed Coding & non-distributed Testing 94 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License
  • 95. Ada 95 DSA & CORBA: Benefits • Save developer’s time, in socket programming: – Defining a client/server protocol – Defining a message format – Marshalling of data – Unmarshalling data • Raise the level of abstraction 95 http://libre.act-europe.fr © ACT Europe under the GNU Free Documentation License