Systems Prog. & Script. - Heriot Watt Univ 1 Systems Programming & Scripting Lecture 11: The Distributed Object Model.

Slides:



Advertisements
Similar presentations
DISTRIBUTED OBJECTS AND REMOTE INVOCATION
Advertisements

Distributed Objects and Remote Invocation
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Distributed Object & Remote Invocation Vidya Satyanarayanan.
.NET Remoting. .Net Remoting Replaces DCOM (Distributed Component Object Model – a proprietary Microsoft technology for communication among software components.
Remote Method Invocation
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Middleware Technologies compiled by: Thomas M. Cosley.
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Communication in Distributed Systems –Part 2
Systems Architecture, Fourth Edition1 Internet and Distributed Application Services Chapter 13.
.NET Mobile Application Development Remote Procedure Call.
Slides for Chapter 5: Communication between distributed objects
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Information Management NTU Interprocess Communication and Middleware.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Source: George Colouris, Jean Dollimore, Tim Kinderberg & Gordon Blair (2012). Distributed Systems: Concepts & Design (5 th Ed.). Essex: Addison-Wesley.
Architectures of distributed systems Fundamental Models
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION. Introduction This chapter is concerned with programming models for distributed applications... Familiar programming.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
IS473 Distributed Systems CHAPTER 5 Distributed Objects & Remote Invocation.
Architecture Models. Readings r Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 3 m Note: All figures from this book.
Common Object Request Broker Architecture (CORBA) The Common Object Request Broker Architecture (CORBA) is a specification of a standard architecture for.
CS 501: Software Engineering Fall 1999 Lecture 12 System Architecture III Distributed Objects.
Shuman Guo CSc 8320 Advanced Operating Systems
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Distributed Objects & Remote Invocation
Distributed Objects and Remote Invocation Source: George Colouris, Jean Dollimore, Tim Kinderberg & Gordon Blair (2012). Distributed Systems: Concepts.
Slides for Chapter 5: Distributed objects and remote invocation From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition.
Remote Method Invocation A Client Server Approach.
1 Distribuerede systemer og sikkerhed – 28. februar 2002 From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley.
Introduction to Distributed Systems and CORBA Slides for CSCI 3171 Lectures E. W. Grundke.
Distributed objects and remote invocation Pages
Distributed Systems Lecture 8 RPC and marshalling 1.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Lecture 5: RPC (exercises/questions). 26-Jun-16COMP28112 Lecture 52 First Six Steps of RPC TvS: Figure 4-7.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
WEB SERVICES From Chapter 19 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
Chapter 5 Remote Procedure Call
Remote Method Invocation
#01 Client/Server Computing
Programming Models for Distributed Application
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
Slides for Chapter 5: Distributed objects and remote invocation
Architectures of distributed systems Fundamental Models
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Architectures of distributed systems Fundamental Models
Remote method invocation (RMI)
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Distribution Infrastructures
Lecture 6: RPC (exercises/questions)
Architectures of distributed systems Fundamental Models
Java Remote Method Invocation
Lecture 6: RPC (exercises/questions)
Lecture 7: RPC (exercises/questions)
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
#01 Client/Server Computing
Presentation transcript:

Systems Prog. & Script. - Heriot Watt Univ 1 Systems Programming & Scripting Lecture 11: The Distributed Object Model

Systems Prog. & Script. - Heriot Watt Univ 2 Introduction The distributed object model is one of executing object- oriented code across a network of machines. It uses the object-based programming model in which objects in different processes communicate through remote method invocation. Central to the distributed object model applications is a middleware component. Middleware is a software component that is based on processes and message passing protocols in a distributed system. The middleware layer uses message exchange protocols such request-reply protocols to provide abstractions on e.g. remote invocations.

Systems Prog. & Script. - Heriot Watt Univ 3 Introduction (cont'd) The middleware layer abstracts over: – Execution site (location transparency), – the communication protocol, – the operating system and – the hardware. See figure in next slide for an illustration of the position of the middleware layer and its relation to other components of a distributed system.

Systems Prog. & Script. - Heriot Watt Univ 4 Middleware Layer Coulouris G., Dollimore J. and Kindberg T., Distributed Systems: Concepts and Design, Pearson Addison and Wesly, 2001 Applications Middleware layers Request reply protocol External data representation Operating System RMI, RPC and events

Systems Prog. & Script. - Heriot Watt Univ 5 Distributed Objects In an object-based system, its state is logically divided into parts with each part associated with a specific object. The distributed object model borrows the basic object-oriented concepts such as: –Object references. –Interfaces (e.g. classes). –Actions, method invocations on objects. –Exceptions. –Garbage collection.

Systems Prog. & Script. - Heriot Watt Univ 6 Distributed Objects (cont'd) A distributed objects system can use a client-server architecture where in this case: –Objects are created and managed by servers. –Clients issue remote method invocations on the servers’ objects to use their services.

Systems Prog. & Script. - Heriot Watt Univ 7 Remote and Local Method Invocations Coulouris G., Dollimore J. and Kindberg T., Distributed Systems: Concepts and Design, Pearson Addison and Wesly, 2001 invocation remote invocation remote local invocation A B C D E F

Systems Prog. & Script. - Heriot Watt Univ 8 Concepts of the Distributed Objects Model Remote Object References: –Extended from the concept of object reference in the object-orientation model where: Any object that can receive a remote method invocation must have a remote object reference. Remote object references can be passed as arguments and results to remote method invocations.

Systems Prog. & Script. - Heriot Watt Univ 9 Concepts of the Distributed Objects Model Remote Interfaces (see figure in next slide): –The class of a remote object implements the methods of its remote interface. –Objects in other processes can only invoke the methods specified in the remote interface. –Remote interfaces do not have constructors, i.e. cannot construct objects directly through interfaces.

Systems Prog. & Script. - Heriot Watt Univ 10 Concepts of the Distributed Objects Model Coulouris G., Dollimore J. and Kindberg T., Distributed Systems: Concepts and Design, Pearson Addison and Wesly, 2001 interface remote m1 m2 m3 m4 m5 m6 Data implementation remote object { of methods

Systems Prog. & Script. - Heriot Watt Univ 11 Concepts of the Distributed Objects Model Garbage Collection: –A typical garbage collector ensures that if there are no references still held to an object, such object is removed and memory is recovered. –A distributed garbage collector not only checks local references to an object but also remote object references from other parts of a distributed system, in order to decide whether to remove an object or not.

Systems Prog. & Script. - Heriot Watt Univ 12 Concepts of the Distributed Objects Model Exceptions: –Remote method invocations can fail due to distribution problem or failure in the execution of the method itself. –Thus, remote method invocations should be able to raise exception on each of the above type of problems occur.

Systems Prog. & Script. - Heriot Watt Univ 13 Implementing RMI A number of objects and modules are required to achieve remote method invocation as shown in the figure on the next slide. This diagram illustrates the operations and components involved when an application-level object A invokes a method in a remote application-level object B. Object A holds a remote object reference for object B. Several modules are required in a remote method invocation including: –Communication modules. –Remote reference modules. –The RMI software including a proxy, a dispatcher and skeleton. The two cooperating communication modules at the client and server implement the request-reply protocol which forms the basis of communication.

Systems Prog. & Script. - Heriot Watt Univ 14 Modules Participating in a Remote Method Invocation Coulouris G., Dollimore J. and Kindberg T., Distributed Systems: Concepts and Design, Pearson Addison and Wesly, 2001 object A object B skeleton Request proxy for B Reply Communication Remote Remote reference Communication module reference module module for B’s class & dispatcher remote client server

Systems Prog. & Script. - Heriot Watt Univ 15 Example: Remote Calculator First we define an interface of the functions that should be provided by the server: public interface ICalc { double Add (double x, double y); double Sub (double x, double y); double Mul (double x, double y); double Div (double x, double y); } Example from “Programming C# 3.0”, Jesse Liberty, O'Reilly. Chapter 19.

Systems Prog. & Script. - Heriot Watt Univ 16 Example: Remote Calculator The server uses remoting libraries: using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http;

Systems Prog. & Script. - Heriot Watt Univ 17 Example: Remote Calculator The main server class: public class Calculator : MarshalByRefObject, ICalc { public Calculator () { Console.WriteLine("Calculator constructor"); } // the four interface functions public double Add (double x, double y) { Console.WriteLine("Add {0} + {1}", x, y); return x+y; }

Systems Prog. & Script. - Heriot Watt Univ 18 Example: Remote Calculator Initialising the server: public class ServerTest { public static void Main() { // create a channel an register HttpChannel chan = new HttpChannel(65102); ChannelServices.RegisterChannel(chan); Type calcType = Type.GetType("CalcServer.Calculator"); // register our well-known type and tell the server // to connect the type to the endpoint "theEndPoint" RemotingConfiguration.RegisterWellKnownServiceType ( calcType, "theEndPoint", WellKnownObjectMode.Singleton );

Systems Prog. & Script. - Heriot Watt Univ 19 Example: Remote Calculator The main client class: public class CalcClient { public static void Main() { // create an http channel HttpChannel chan = new HttpChannel(0); ChannelServices.RegisterChannel(chan); // get my remote object MarshalByRefObject obj = (MarshalByRefObject) RemotingServices.Connect ( typeof(CalcServer.ICalc) // what to get " // where ); try {// cast object to interface CalcServer.ICalc calc = obj as CalcServer.ICalc; // use the interface to call methods double sum = calc.Add(3.0,4.0); Console.WriteLine("3+4 = {0}", sum);

Systems Prog. & Script. - Heriot Watt Univ 20 Example: Remote Calculator Compile the components individually: – gmcs -target:library ICalc.cs – gmcs -pkg:dotnet -reference:ICalc CalcServer.cs – gmcs -pkg:dotnet -reference:ICalc CalcClient.cs Run Server and Client as separate programs: – mono CalcServer.exe – mono CalcClient.exe This will print – 3+4 = 7