SlideShare uma empresa Scribd logo
1 de 17
RMI
Concurrent & Distributed software

BY
Ravi Theja Y
Remote Procedure Calls (RPC)
•Goal: To provide a procedural interface for distributed (i.e., remote)

services

•To make distributed nature of service transparent to the programmer

Remote Method Invocation (RMI)
•Goal: RPC + Object Orientation
•Allows objects living in one process to invoke methods of an object living

in another process
Middleware layers

Middleware layers
Request and Reply communication
Conventional Procedure Call
Parameter passing in a local procedure call: the stack before the call to
read(fd,buf,bytes)
The stack while the called procedure is active
Remote Procedure Call
Principle of RPC between a client and server program.
Remote Procedure Calls
Remote procedure call (RPC) abstracts procedure calls between processes on networked
systems.
Stubs – client-side proxy for the actual procedure on the server.
The client-side stub locates the server and marshalls the parameters.
The server-side stub receives this message, unpacks the marshalled parameters, and
performs the procedure on the server.
Steps of a Remote Procedure Call
1.

Client procedure calls client stub in normal way

2.

Client stub builds message, calls local OS

3.

Client's OS sends message to remote OS

4.

Remote OS gives message to server stub

5.

Server stub unpacks parameters, calls server

6.

Server does work, returns result to the stub

7.

Server stub packs it in message, calls local OS

8.

Server's OS sends message to client's OS

9.

Client's OS gives message to client stub

10. Stub unpacks result, returns to client
RMI
RMI = RPC + Object-orientation
Java RMI
CORBA
• Middleware that is language-independent

Microsoft DCOM/COM+
SOAP
• RMI on top of HTTP
Interfaces in distributed systems
Programs organized as a set of modules that communicate with one another via
procedure calls/method invocations
Explicit interfaces defined for each module in order to control interactions between
modules
In distributed systems, modules can be in different processes
A remote interface specifies the methods of an object that are available for invocation
by objects in other processes defining the types of the input and output arguments of
each of them.
Object model
Object references
Objects accessed via object references
Object references can be assigned to variables, passed as arguments and returned as
results
Interfaces provides a signature of a set of methods (types of arguments, return values
and exceptions) without specifying their implementations
Actions (invocations)
Exceptions
Garbage Collection
Distributed Objects
Remote object references
An identifier that can be used throughout a distributed
system to refer to a particular remote object
Remote interfaces
CORBA provides an interface definition language (IDL) for specifying a remote interface
JAVA RMI: Java interface that extends Remote interface
Actions: remote invocations
Remote Exceptions may arise for reasons such as partial failure or message loss
Distributed Garbage Collection: cooperation between local garbage collectors needed
Remote and local method
invocations

A remote object and its remote
interface
RMI Programming
RMI software
Generated by IDL compiler
Proxy
• Behaves like remote object to clients (invoker)
• Marshals arguments, forwards message to remote object, unmarshals
results, returns results to client

Skeleton
• Server side stub;
• Unmarshals arguments, invokes method, marshals results and sends
to sending proxy’s method

Dispatcher
• Receives the request message from communication module, passes
on the message to the appropriate method in the skeleton
Role of proxy and skeleton in remote method
invocation
Calculator.java
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Calculator extends Remote
{
public long add(long a,long b) throws RemoteException;
}

Calculatorserver.java

Calculatorimpl.java

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class CalculatorImpl extends UnicastRemoteObject implements Calculator
{
protected CalculatorImpl() throws RemoteException
{
super();
}
public long add(long a, long b) throws RemoteException
{
return a+b;
}
}
-------------------------------------------------------------------------------------------

import java.rmi.Naming;
public class CalculatorServer
{
CalculatorServer()
{try
{
Calculator c = new CalculatorImpl();
Naming.rebind("rmi://127.0.0.1:1099/CalculatorService", c);
}
catch (Exception e)
{ e.printStackTrace(); }
}
public static void main(String[] args)
{
new CalculatorServer();
}}

import java.rmi.Naming;
public class CalculatorClient
{
public static void main(String[] args)
Calculatorclient.java
{
try
{
Calculator c = (Calculator)
Naming.lookup("//127.0.0.1:1099/CalculatorService");
System.out.println("addition : "+c.add(10, 15));
}
catch (Exception e)
{
System.out.println(e);
}}}
RMI systems
CORBA – language independent
DCOM - Microsoft
Java RMI
SOAP (Simple Object Access Protocol)
HTTP is request-reply protocol
XML for data representation
Thank you

Mais conteúdo relacionado

Mais procurados

Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven schedulingKamal Acharya
 
Disk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemDisk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemMeghaj Mallick
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationPradeep Kumar TS
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin schedulingRaghav S
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Schedulingsathish sak
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
Unit 3 principles of programming language
Unit 3 principles of programming languageUnit 3 principles of programming language
Unit 3 principles of programming languageVasavi College of Engg
 
Software Engineering (Project Planning & Estimation)
Software Engineering (Project Planning &  Estimation)Software Engineering (Project Planning &  Estimation)
Software Engineering (Project Planning & Estimation)ShudipPal
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process CommunicationAdeel Rasheed
 
Mutual exclusion in distributed systems
Mutual exclusion in distributed systemsMutual exclusion in distributed systems
Mutual exclusion in distributed systemsAJAY KHARAT
 

Mais procurados (20)

Clock driven scheduling
Clock driven schedulingClock driven scheduling
Clock driven scheduling
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Disk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating SystemDisk Scheduling Algorithm in Operating System
Disk Scheduling Algorithm in Operating System
 
Cocomo model
Cocomo modelCocomo model
Cocomo model
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 
Stream oriented communication
Stream oriented communicationStream oriented communication
Stream oriented communication
 
Process scheduling linux
Process scheduling linuxProcess scheduling linux
Process scheduling linux
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin scheduling
 
Pass Structure of Assembler
Pass Structure of AssemblerPass Structure of Assembler
Pass Structure of Assembler
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Scheduling
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
MPI
MPIMPI
MPI
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Unit 3 principles of programming language
Unit 3 principles of programming languageUnit 3 principles of programming language
Unit 3 principles of programming language
 
Analysis of the source program
Analysis of the source programAnalysis of the source program
Analysis of the source program
 
Software Engineering (Project Planning & Estimation)
Software Engineering (Project Planning &  Estimation)Software Engineering (Project Planning &  Estimation)
Software Engineering (Project Planning & Estimation)
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Java threads
Java threadsJava threads
Java threads
 
Mutual exclusion in distributed systems
Mutual exclusion in distributed systemsMutual exclusion in distributed systems
Mutual exclusion in distributed systems
 

Destaque

Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Peter R. Egli
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method InvocationPaul Pajo
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage CollectionAzul Systems Inc.
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure CallAbdelrahman Al-Ogail
 
Java RMI Presentation
Java RMI PresentationJava RMI Presentation
Java RMI PresentationMasud Rahman
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure callsAshish Kumar
 

Destaque (6)

Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Understanding Java Garbage Collection
Understanding Java Garbage CollectionUnderstanding Java Garbage Collection
Understanding Java Garbage Collection
 
Introduction to Remote Procedure Call
Introduction to Remote Procedure CallIntroduction to Remote Procedure Call
Introduction to Remote Procedure Call
 
Java RMI Presentation
Java RMI PresentationJava RMI Presentation
Java RMI Presentation
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
 

Semelhante a remote method invocation

Ds objects and models
Ds objects and modelsDs objects and models
Ds objects and modelsMayank Jain
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocationashishspace
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMIbackdoor
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMIbackdoor
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIPrajakta Rane
 
DS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdfDS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdfVarshaBaini
 
20CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 220CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 2Kathirvel Ayyaswamy
 
Module 3 remote method invocation-2
Module 3   remote method  invocation-2Module 3   remote method  invocation-2
Module 3 remote method invocation-2Ankit Dubey
 
05 rpc-case studies
05 rpc-case studies05 rpc-case studies
05 rpc-case studieshushu
 
Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Sri Prasanna
 
CHP-4.pptx
CHP-4.pptxCHP-4.pptx
CHP-4.pptxFamiDan
 

Semelhante a remote method invocation (20)

RMI (Remote Method Invocation)
RMI (Remote Method Invocation)RMI (Remote Method Invocation)
RMI (Remote Method Invocation)
 
Ds objects and models
Ds objects and modelsDs objects and models
Ds objects and models
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
009693652.pdf
009693652.pdf009693652.pdf
009693652.pdf
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMI
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
 
Rmi
RmiRmi
Rmi
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMI
 
DS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdfDS R16 - UNIT-3.pdf
DS R16 - UNIT-3.pdf
 
20CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 220CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 2
 
20CS2021 Distributed Computing
20CS2021 Distributed Computing 20CS2021 Distributed Computing
20CS2021 Distributed Computing
 
Module 3 remote method invocation-2
Module 3   remote method  invocation-2Module 3   remote method  invocation-2
Module 3 remote method invocation-2
 
05 rpc-case studies
05 rpc-case studies05 rpc-case studies
05 rpc-case studies
 
Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)
 
DS
DSDS
DS
 
CHP-4.pptx
CHP-4.pptxCHP-4.pptx
CHP-4.pptx
 
18CS3040_Distributed Systems
18CS3040_Distributed Systems18CS3040_Distributed Systems
18CS3040_Distributed Systems
 
18CS3040 Distributed System
18CS3040 Distributed System	18CS3040 Distributed System
18CS3040 Distributed System
 
Rmi
RmiRmi
Rmi
 
Rmi
RmiRmi
Rmi
 

Último

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

remote method invocation

  • 1. RMI Concurrent & Distributed software BY Ravi Theja Y
  • 2. Remote Procedure Calls (RPC) •Goal: To provide a procedural interface for distributed (i.e., remote) services •To make distributed nature of service transparent to the programmer Remote Method Invocation (RMI) •Goal: RPC + Object Orientation •Allows objects living in one process to invoke methods of an object living in another process
  • 4. Request and Reply communication
  • 5. Conventional Procedure Call Parameter passing in a local procedure call: the stack before the call to read(fd,buf,bytes) The stack while the called procedure is active
  • 6. Remote Procedure Call Principle of RPC between a client and server program.
  • 7. Remote Procedure Calls Remote procedure call (RPC) abstracts procedure calls between processes on networked systems. Stubs – client-side proxy for the actual procedure on the server. The client-side stub locates the server and marshalls the parameters. The server-side stub receives this message, unpacks the marshalled parameters, and performs the procedure on the server.
  • 8. Steps of a Remote Procedure Call 1. Client procedure calls client stub in normal way 2. Client stub builds message, calls local OS 3. Client's OS sends message to remote OS 4. Remote OS gives message to server stub 5. Server stub unpacks parameters, calls server 6. Server does work, returns result to the stub 7. Server stub packs it in message, calls local OS 8. Server's OS sends message to client's OS 9. Client's OS gives message to client stub 10. Stub unpacks result, returns to client
  • 9. RMI RMI = RPC + Object-orientation Java RMI CORBA • Middleware that is language-independent Microsoft DCOM/COM+ SOAP • RMI on top of HTTP
  • 10. Interfaces in distributed systems Programs organized as a set of modules that communicate with one another via procedure calls/method invocations Explicit interfaces defined for each module in order to control interactions between modules In distributed systems, modules can be in different processes A remote interface specifies the methods of an object that are available for invocation by objects in other processes defining the types of the input and output arguments of each of them.
  • 11. Object model Object references Objects accessed via object references Object references can be assigned to variables, passed as arguments and returned as results Interfaces provides a signature of a set of methods (types of arguments, return values and exceptions) without specifying their implementations Actions (invocations) Exceptions Garbage Collection Distributed Objects Remote object references An identifier that can be used throughout a distributed system to refer to a particular remote object Remote interfaces CORBA provides an interface definition language (IDL) for specifying a remote interface JAVA RMI: Java interface that extends Remote interface Actions: remote invocations Remote Exceptions may arise for reasons such as partial failure or message loss Distributed Garbage Collection: cooperation between local garbage collectors needed
  • 12. Remote and local method invocations A remote object and its remote interface
  • 13. RMI Programming RMI software Generated by IDL compiler Proxy • Behaves like remote object to clients (invoker) • Marshals arguments, forwards message to remote object, unmarshals results, returns results to client Skeleton • Server side stub; • Unmarshals arguments, invokes method, marshals results and sends to sending proxy’s method Dispatcher • Receives the request message from communication module, passes on the message to the appropriate method in the skeleton
  • 14. Role of proxy and skeleton in remote method invocation
  • 15. Calculator.java import java.rmi.Remote; import java.rmi.RemoteException; public interface Calculator extends Remote { public long add(long a,long b) throws RemoteException; } Calculatorserver.java Calculatorimpl.java import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class CalculatorImpl extends UnicastRemoteObject implements Calculator { protected CalculatorImpl() throws RemoteException { super(); } public long add(long a, long b) throws RemoteException { return a+b; } } ------------------------------------------------------------------------------------------- import java.rmi.Naming; public class CalculatorServer { CalculatorServer() {try { Calculator c = new CalculatorImpl(); Naming.rebind("rmi://127.0.0.1:1099/CalculatorService", c); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { new CalculatorServer(); }} import java.rmi.Naming; public class CalculatorClient { public static void main(String[] args) Calculatorclient.java { try { Calculator c = (Calculator) Naming.lookup("//127.0.0.1:1099/CalculatorService"); System.out.println("addition : "+c.add(10, 15)); } catch (Exception e) { System.out.println(e); }}}
  • 16. RMI systems CORBA – language independent DCOM - Microsoft Java RMI SOAP (Simple Object Access Protocol) HTTP is request-reply protocol XML for data representation