Remote Procedure Call in SR Programming Language By Tze-Kin Tsang 3/20/2000.

Slides:



Advertisements
Similar presentations
Chapter 5: Abstraction, parameterization, and qualification Xinming (Simon) Ou CIS 505: Programming Languages Kansas State University Fall
Advertisements

CSI 3120, Implementing subprograms, page 1 Implementing subprograms The environment in block-structured languages The structure of the activation stack.
Remote Procedure Call Design issues Implementation RPC programming
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 7: User-Defined Functions II.
Chapter 7: User-Defined Functions II
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Lecture 16 Subroutine Calls and Parameter Passing Semantics Dragon: Sec. 7.5 Fischer: Sec Procedure declaration procedure p( a, b : integer, f :
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 7: User-Defined Functions II.
Lecture 2 Basics of C#. Members of a Class A field is a variable of any type that is declared directly in a class. Fields are members of their containing.
Remote Object Invocation
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 7: User-Defined Functions II.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
ספטמבר 04Copyright Meir Kalech1 C programming Language Chapter 3: Functions.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Run time vs. Compile time
Outcomes What is RPC? The difference between conventional procedure call and RPC? Understand the function of client and server stubs How many steps could.
Communication in Distributed Systems –Part 2
Asynchronous Message Passing EE 524/CS 561 Wanliang Ma 03/08/2000.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
.NET Mobile Application Development Remote Procedure Call.
CSC321: Programming Languages1 Programming Languages Tucker and Noonan Chapter 9: Functions 9.1 Basic Terminology 9.2 Function Call and Return 9.3 Parameters.
Chapter 6: Modularity Using Functions. In this chapter, you will learn about: – Function and parameter declarations – Returning a single value – Returning.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 6: User-Defined Functions
Problems with Send and Receive Low level –programmer is engaged in I/O –server often not modular –takes 2 calls to get what you want (send, followed by.
COMPUTER PROGRAMMING. Functions What is a function? A function is a group of statements that is executed when it is called from some point of the program.
CpSc 462/662: Database Management Systems (DBMS) (TEXNH Approach) Stored Procedure James Wang.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
 Remote Procedure Call (RPC) is a high-level model for client-sever communication.  It provides the programmers with a familiar mechanism for building.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
Chapter 7 Functions. Types of Functions Value returning Functions that return a value through the use of a return statement They allow statements such.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Remote Procedure Call Andy Wang Operating Systems COP 4610 / CGS 5765.
Mark Stanovich Operating Systems COP Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Remote Procedure Call and Serialization BY: AARON MCKAY.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Introduction to Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Procedure Definitions and Semantics Procedures support control abstraction in programming languages. In most programming languages, a procedure is defined.
Channels. Models for Communications Synchronous communications – E.g. Telephone call Asynchronous communications – E.g. .
1 Chapter 8 Scope, Lifetime, and More on Functions CS185/09 - Introduction to Programming Caldwell College.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
1 Sections 6.4 – 6.5 Methods and Variables Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
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.
Functions.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
“Language Mechanism for Synchronization”
Prof. Leonardo Mostarda University of Camerino
Java Primer 1: Types, Classes and Operators
Functions, locals, parameters, and separate compilation
Organization of Programming Languages
User-Defined Functions
Programming Models for Distributed Application
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Sarah Diesburg Operating Systems COP 4610
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Remote Procedure Call (invocation) RPC
Distribution Infrastructures
Lecture 6: RPC (exercises/questions)
Lecture 6: RPC (exercises/questions)
Lecture 7: RPC (exercises/questions)
Corresponds with Chapter 5
Procedures & Macros Introduction Syntax Difference.
Presentation transcript:

Remote Procedure Call in SR Programming Language By Tze-Kin Tsang 3/20/2000

Remote Procedure Call (RPC) Introduction Mechanisms for Remote Procedure Call Equivalence to Send/Receive Pairs Return, Reply, and Forward Statements Summary

Introduction : RPC involves two processes –the invoker/client and the server Client: the process doing the call Server: the process created to service the call Typically in different resources and might even be on different virtual or physical machines RPC is synchronous from the client’s perspective The invoking process waits for results to be returned from the call

RPC is accomplished through the use of operations to initiate a RPC, the invoking process calls an operation, which is serviced by a proc a call invocation of a remote proc results in a process being created to service the invocation a remote procedure call resembles a sequential procedure call both syntactically and semantically the remote proc is transparent to the caller –does not know whether the call is located on a different virtual or physical machine a remote procedure call takes longer than a local, sequential procedure call

Mechanisms for Remote Procedure Call The mechanisms for RPC are operations, call invocation, and procs. A new process is created to execute the proc’s code for the invocation. The invoked proc can be located in another resource, which might be located on another virtual or physical machine.

The syntax and semantics of the local and remote calls are the same only the implementation and consequently the performance are different

Problems: can lead to more than one process manipulating the shared stack variables at the same time for example, two processes, each execute an invocation of push, can overflow the array. synchronize the processes to avoid the problems –semaphore

Equivalence to Send/Receive Pairs A (remote) procedure call can be written as a send to a proc to create the process plus a receive to get back results when the process has completed.

The following codes are equivalent. Op p (val x: int; var y: int; res z: int) process q var a, b, c: int … call p (a, b, c) end proc p (x, y, z) z := x+4 y -:=10 end Op p (x, y: int), r (y, z: int) process q var a, b, c: int … send p (a, b) receive r (b, c) end proc p (x, y) var z: int z := x+4 y -:= 10 send r (y, z) end

The following codes are equivalent. Op p (val x: int; var y: int; res z: int) process q (i := 1 to …) var a, b, c: int … call p (a, b, c) end proc p (x, y, z) z := x+4 y -:=10 end Op p (x, y: int; rcap: cap (y, z: int)) process q (i := 1 to …) var a, b, c: int … op r (y, z: int) send p (a, b, r) receive r (b, c) end proc p (x, y, rcap) var z: int z := x+4 y -:= 10 send rcap (y, z) end

Call Invocation VS Send/Receive Pair a call invocation provides a cleaner interface than does a send/receive pair a call invocation allows invocations of value-returning operations within expressions send/receive pair requires declaring a local operation to which results get sent and passing a capability for that operation

Send/receive pairs are useful when a client wants to do some work between initiating a request for service and picking up results from that request call invocation precludes clients from performing other work while waiting for the server to give back results

Return, Reply, and Forward Statements provide additional flexibility in handling remote procedure calls appear in the body of a proc alter the way results are passed back to the invoking process

Return It has the form: return A return statement terminates both the call invocation and the process that executes the return any results of the invocation (variable, result parameters, and return value) are returned to the invoker

When a proc does not want to wait for its completion, it may execute a return statement if the proc was invoked by send –return statement just terminates the process that executes the return –any results from the proc are not actually returned

Reply It has the form: reply The reply statement is used by a proc to continue execution after servicing an invocation of the proc terminates the invocation being serviced by the enclosing proc a process that executes a reply statement continues executing with the statement following the reply

no effect to a send invocation a subsequent reply has no effect to an invocation for which a reply has already been executed

Forward The forward statement defers replying to a called invocation and instead passes on this reponsibility transparent to the original invoker

it has the form: forward operation (expr, expr, …) takes the operation invocation currently being serviced evaluates a possibly new set of arguments invokes the named operation an invocation can be forwarded to any operation having the same signature the caller remains blocked until the new invocation has been serviced to completion

the forwarding process continues with the next statement, but no subsequent changes to variables will be seen by other process a subsequent forward of the same invocation = a send invocation from the forwarding process a subsequent reply to a forwarded invocation has no effect a subsequent return has the usual effect of causing the executing process to exit the block

Resource fun () op f (x: int) returns z: int op g (y: int) returns z: int process p var a := f(1); write (a) end proc f(x) returns z forward g (2*x) … # continue executing, perhaps changing z end proc g(y) returns z z := y+10 end

A realistic example: Client processes make requests for service to a central allocator process. The allocator assigns a server process to the request by forwarding the invocation to it. The allocator might represent a file server that determines on which server the requested file is located and forwards the client’s request to the server, which typically would be located on a different machine.

Summary Remote Procedure Call involves two processes, a client and a server. RPC is another use of operation The mechanisms for RPC are operation declarations, call invocations, and procs. RPC is equivalent to send/receive pairs The return, reply, and forward statements provide additional flexibility in handling remote procedure calls.