rpc implementation steps - computer science · rpc awareness in application: two extremes rpc...

34
RPC IMPLEMENTATION: BASIC STEPS Instructor: Prasun Dewan Department of Computer Science University of North Carolina at Chapel Hill [email protected]

Upload: others

Post on 29-Sep-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

RPC IMPLEMENTATION: BASIC

STEPS

Instructor: Prasun Dewan

Department of Computer Science

University of North Carolina at Chapel Hill

[email protected]

Page 2: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

2

SIMULATING REMOTE PROCEDURE CALL

Port

(Mailbox)

Port

(Mailbox)

Process/

Thread

Process/

Thread

Process/

Thread

Process/

Thread

<method var><method var>

<params><params>

<method><method>

<params var><params var>

<params><params>

<method><method>

<method> (<params>)<method> (<params>)

<method><method>

<params><params>

Send expressions encoding method and parameters

These are assigned to corresponding remote variables

Side effect of assignment is to call method with parameters

Goal is to call a method with params

<method> (<params>)<method> (<params>)

vs. local call?vs. local call?

Page 3: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

3

Activation Record (parameters, return

value, return address, and other info)

Activation Record (parameters, return

value, return address, and other info)

ACTIVATION RECORD VS. RPC MESSAGES

Activation Record (Parameters, return

value, return address, and other info)

Activation Record (Parameters, return

value, return address, and other info)

Calling

Process

Calling

Process

Call message (operation id, parameters,

source)

Call message (operation id, parameters,

source)

Return message (return value)

Return message (return value)

Called

process

Called

process

Activation Record (Parameters, return

value, return address, and other info)

Activation Record (Parameters, return

value, return address, and other info)

Stack

Stack

Call results in marshalling and unmarshalling of call/return value rather than push and pop of activation record on

stack

(Un)marshalling of call: translation between call and

message

Page 4: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

4

DATA SET UP

Server exports external description of data (RA) port

Client determines external description

Statically or dynamicallyStatically or dynamically

Statically or dynamicallyStatically or dynamically

Server starts and makes data port connectable

Client starts and establishes connection

Page 5: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

5

RPC SET UP

Server exports external description of calls serviced on RA (data) port

Client finds this information

Statically or dynamicallyStatically or dynamically

Statically or dynamicallyStatically or dynamically

Page 6: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

6

PROCESSING OF CALL MESSAGE AND RETURN

VALUE

Generate call message for call using exported information

Process call message in caller process

Communicate call message on data port and handle errors

Process call message in callee process

Invoke called operation

Page 7: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

7

PROCESSING OF CALL MESSAGE AND RETURN

VALUE

Possibly create return message in callee process

Communicate return message to caller process

Process return message in callee process and handle errors

Return value to caller operation

Page 8: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

8

AUTOMATION OF REMOTE PROCEDURE CALL

Port

(Mailbox)

Port

(Mailbox)

Process/

Thread

Process/

Thread

Process/

Thread

Process/

Thread

<method var><method var>

<params><params>

<method><method>

<params var><params var>

<params><params>

<method><method>

<method> (<params>)<method> (<params>)

<method><method>

<params><params>

<method> (<params>)<method> (<params>)

RPC System@Calling SiteRPC System@Calling Site

RPC System @Callee SiteRPC System @Callee Site

App @ Calling SiteApp @ Calling Site

App @Calleee SiteApp @Calleee Site

Division of labor?Division of labor?

Page 9: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

9

RPC AWARENESS IN APPLICATION: TWO

EXTREMES

RPC clients and servers handle all aspects of RPC and are completely aware of all of the steps listed below

RPC clients and servers are completely unaware of distribution details

Java RMI falls close to complete transparency Java RMI falls close to complete transparency

GIPC RMI supports a wider spectrum that falls closer and furtherGIPC RMI supports a wider spectrum that falls closer and further

Can one have complete transparency? (Answered at the end –actually deleted from this overview of basic steps)

Can one have complete transparency? (Answered at the end –actually deleted from this overview of basic steps)

Page 10: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

10

RPC VS. RMI

RPC: O-O or Conventional

RMI: O-O

Page 11: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

11

MAIN O-O EXAMPLES

Java RMI

GIPC RMI

Will use GIPC as an example of detailed implementationWill use GIPC as an example of detailed implementation

Page 12: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

12

GIPC VS. RMI

Allow remote assignment and remote procedure call on same port

Allow remote assignment and remote procedure call on same port

Notion of connected client and server port visibleNotion of connected client and server port visible

Distinguishing between regular and RPC messages?Distinguishing between regular and RPC messages?

Calling

Process

Calling

Process

Call message (operation id, parameters,

source)

Call message (operation id, parameters,

source)

Return message (return value)

Return message (return value)

Called

process

Called

process

Non RPC MessageNon RPC Message

Non RPC MessageNon RPC Message

Page 13: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

13

DISTINGUISHING RPC AND REGULAR MESSAGES

Use special GIPC types for RPC MessagesUse special GIPC types for RPC Messages

Applications cannot pass instances of these types directlyApplications cannot pass instances of these types directly

GIPC RPC traps instances of these types and passes others to application listeners of underlying data ports

GIPC RPC traps instances of these types and passes others to application listeners of underlying data ports

Should allow GIPC developers to change the nature and processing of of these messages without changing the complete

RPC system

Should allow GIPC developers to change the nature and processing of of these messages without changing the complete

RPC system

Nature of these messages?Nature of these messages?

Page 14: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

14

PROCESSING OF CALL MESSAGE AND RETURN

VALUE

Generate call message for call using exported informationGenerate call message for call using exported information

Possibly create return message in callee processPossibly create return message in callee process

Calling

Process

Calling

Process

Call message (operation id, parameters,

source)

Call message (operation id, parameters,

source)

Return message (return value)

Return message (return value)

Called

process

Called

process

Non RPC MessageNon RPC Message

Non RPC MessageNon RPC Message

Page 15: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

15

METHOD RETURN VALUE

RPCReturnValueRPCReturnValue Object returnValueObject returnValue

Page 16: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

16

CALL MESSAGE

Call

<ObjectIDType>

Call

<ObjectIDType>

transient Method methodtransient Method method

ObjectIDType targetObjectObjectIDType targetObject

Object[] argsObject[] args

SerializableCallSerializableCall

extends <String>extends <String>

SerializedMethod serializedMethodSerializedMethod serializedMethod

SerializeMethodSerializeMethod

transient Method methodtransient Method method

String[] parameterTypeNamesString[] parameterTypeNames

String methodNameString methodName

String classNameString className

Page 17: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

17

SERIALIZING A METHOD

Marshaller<ObjectIdType>

Marshaller<ObjectIdType>

Call<ObjectIdType> marshallCall(

ObjectIdType aTargetObject, Method

aMethod, Object[] anArgsList)

Call<ObjectIdType> marshallCall(

ObjectIdType aTargetObject, Method

aMethod, Object[] anArgsList)

Call

<ObjectIDType>

Call

<ObjectIDType> transient Method

serializableMethod

transient Method

serializableMethod

ObjectIDType

targetObject

ObjectIDType

targetObject

Object[] argsObject[] args

Page 18: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

18

PORT VS. GIPC-RMI

Client ObjectClient Object Server ObjectServer Object

Server ProxyServer Proxy

m(p1, … pN)m(p1, … pN)

m(p1, … pN)m(p1, … pN)

Client PortClient Port

Server PortServer Port

Synchronization?Synchronization?

Page 19: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

19

PROCESSING OF CALL MESSAGE AND RETURN

VALUE

Generate call message for call using exported informationGenerate call message for call using exported information

Process call message in caller processProcess call message in caller process

Communicate call message on data port and handle errorsCommunicate call message on data port and handle errors

Process call message in callee processProcess call message in callee process

Invoke called operationInvoke called operation

Page 20: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

20

PROCESSING OF CALL MESSAGE AND RETURN

VALUE

Possibly create return message in callee processPossibly create return message in callee process

Communicate return message to caller processCommunicate return message to caller process

Process return message in callee process and handle errors Process return message in callee process and handle errors

Return value to caller operationReturn value to caller operation

Page 21: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

21

OBJECT FORWARDERS AND SERIALIZERS

Sender <Object>

(Object Port)

Sender <Object>

(Object Port)

Sender<ByteBuffer>

(Buffer Skeleton)

Sender<ByteBuffer>

(Buffer Skeleton)

Receive Listener

<ByteBuffer> (Buffer

Skeleton)

Receive Listener

<ByteBuffer> (Buffer

Skeleton)

Receive

Notifier<Object>

Receive

Notifier<Object>

Send Forwarder

<Object, Object>

Send Forwarder

<Object, Object> ReceiveForwarder

<Object, Object>

ReceiveForwarder

<Object, Object>

Serializer

<Object, ByteBuffer>

Serializer

<Object, ByteBuffer> Deserializer

<ByteBuffer, Object>

Deserializer

<ByteBuffer, Object>

Page 22: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

22

OBJECT FORWARDERS AND SERIALIZERS

Sender <Object>

(RPC Port)

Sender <Object>

(RPC Port)

Sender <Object>

(Object Port)

Sender <Object>

(Object Port)

Receive Listener

<Object> (RPC Port)

Receive Listener

<Object> (RPC Port)

Receive

Notifier<Object>

Receive

Notifier<Object>

Call Message and Return

Message SendTrapper

<Object, Object>

Call Message and Return

Message SendTrapper

<Object, Object>

Call Message and Return

Message ReceiveTrapper

<Object, Object>

Call Message and Return

Message ReceiveTrapper

<Object, Object>

Shared Data

Structures

Shared Data

Structures

Send trapper may need to block sender to implement synchronous operationSend trapper may need to block sender to implement synchronous operation

Send and receive trapper may need to share information about remote references sent and received

Send and receive trapper may need to share information about remote references sent and received

Page 23: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

23

OBJECT FORWARDERS AND SERIALIZERS (REVIEW)

Sender <Object>

(RPC Port)

Sender <Object>

(RPC Port)

Sender <Object>

(Object Port)

Sender <Object>

(Object Port)

Receive Listener

<Object> (RPC Port)

Receive Listener

<Object> (RPC Port)

Receive

Notifier<Object>

Receive

Notifier<Object>

Call Message and Return

Message SendTrapper

<Object, Object>

Call Message and Return

Message SendTrapper

<Object, Object>

Call Message and Return

Message ReceiveTrapper

<Object, Object>

Call Message and Return

Message ReceiveTrapper

<Object, Object>

Coordinating

Shared Data

Structures

Coordinating

Shared Data

Structures

Send trapper may need to block sender to implement synchronous operationSend trapper may need to block sender to implement synchronous operation

Page 24: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

24

OBJECT FORWARDERS AND SERIALIZERS (REVIEW)

Sender <Object>

(RPC Port)

Sender <Object>

(RPC Port)

Sender <Object>

(Object Port)

Sender <Object>

(Object Port)

Receive Listener

<Object> (RPC Port)

Receive Listener

<Object> (RPC Port)

Receive

Notifier<Object>

Receive

Notifier<Object>

Call Message and Return

Message SendTrapper

<Object, Object>

Call Message and Return

Message SendTrapper

<Object, Object>

Call Message and Return

Message ReceiveTrapper

<Object, Object>

Call Message and Return

Message ReceiveTrapper

<Object, Object>

SentCall

Completer

SentCall

Completer

SendTrapper and ReceiveTrapper at Caller Share an Instance of Synchronizing SentCallCompleter

SendTrapper and ReceiveTrapper at Caller Share an Instance of Synchronizing SentCallCompleter

Coordination between Caller and Called Site? Coordination between Caller and Called Site?

Page 25: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

25

DUPLEX SENT CALL COMPLETER (PUBLIC AND

NON PUBLIC METHODS, NEW NAMES)

processReturnValue (String aSource, Object

aMessage);

processReturnValue (String aSource, Object

aMessage);

returnValueOfRemoteMethodCall() called, after call message sent: receive return value and block caller if necessary

returnValueOfRemoteMethodCall() called, after call message sent: receive return value and block caller if necessary

Object returnValueOfRemoteMethodCall

(String aRemoteEndPoint, Object aCall)

Object returnValueOfRemoteMethodCall

(String aRemoteEndPoint, Object aCall)

ADuplexSentCall CompleterADuplexSent

Call Completer

Object returnValueOfRemoteFunctionCall

(String aRemoteEndPoint, Object aCall)

Object returnValueOfRemoteFunctionCall

(String aRemoteEndPoint, Object aCall)

Object returnValueOfRemoteProcedureCall

(String aRemoteEndPoint, Object aCall)

Object returnValueOfRemoteProcedureCall

(String aRemoteEndPoint, Object aCall)Non blocking,

simply returns

Non blocking,

simply returns

Blocks for

return value

Blocks for

return value

UnblocksUnblocks

Renamed: returnValueOfRemoteFunction(Procedure)Call

getReturnValueOfRemoteFunction(Procedure)Call, processReturnValuereturnValueReceived

Renamed: returnValueOfRemoteFunction(Procedure)Call

getReturnValueOfRemoteFunction(Procedure)Call, processReturnValuereturnValueReceived

Page 26: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

26

RPCReturnValue

Queue

(BoundedBuffer)

RPCReturnValue

Queue

(BoundedBuffer)

FUNCTION CALL SYNCHRONIZATION AND

MATCHED CLIENT/SERVER OBJECTS

ReceivedCall

Invoker

ReceivedCall

Invoker

Remote function call is blockingRemote function call is blocking

CallCall

Return

Val

Return

Val

CallCall

RemoteObjectRemoteObjectT m(…)T m(…)

ProxyProxyT m(…)T m(…)

SentCall

Completer

SentCall

Completer

Return

Val

Return

Val

get()get()put()put()

returnValueOfRemoteFunctionCall()returnValueOfRemoteFunctionCall()

process

Return

Value()

process

Return

Value()

handle

Function

Return()

handle

Function

Return()

messageReceived()message

Received()

MarshallerMarshallermarshall

Callmarshall

CallSendTrapperSendTrapper

send()send()

SendTrapperSendTrapper

send()send()

ReceiveTrapperReceiveTrapper

receive()receive()

ReceiveTrapperReceiveTrapper

receive()receive()

Page 27: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

27

PROCEDURE CALL SYNCHRONIZATION AND

MATCHED CLIENT/SERVER OBJECTS

ReceivedCall

Invoker

ReceivedCall

Invoker

Remote procedure call is not blocking

Remote procedure call is not blocking

CallCall

CallCall

RemoteObjectRemoteObjectT m(…)T m(…)

ProxyProxyT m(…)T m(…)

SentCall

Completer

SentCall

CompleterreturnValueOfRemoteProcedureCall()returnValueOfRemoteProcedureCall()

handle

Procedure

Return()

handle

Procedure

Return()

messageReceived()message

Received()

MarshallerMarshallermarshall

Callmarshall

CallSendTrapperSendTrapper

send()send()

ReceiveTrapperReceiveTrapper

receive()receive()

Page 28: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

28

SYNCHRONOUS CALLBACK IN REMOTE CALL

RPCMessageReceiver

RPCMessageReceiver messageReceived()messageReceived()

NIO

Selection

Thread

NIO

Selection

Thread

SelectorSelector

Remote function call is blockingRemote function call is blocking

select()select()

CallCall

Return

Val

Return

Val

CallCall

RemoteObjectRemoteObjectm1(…)m1(…)

ProxyProxy

T m2(…)T m2(…)

get()get()

RPCReturnValue

Queue

(BoundedBuffer)

RPCReturnValue

Queue

(BoundedBuffer)

put()put()

Page 29: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

29

GIPC ASYNCHRONOUS INVOKER (FACTORY

SELECTED)

RPCMessageReceiver

RPCMessageReceiver messageReceived()messageReceived()

NIO

Selection

Thread

NIO

Selection

Thread

SelectorSelector

Remote function call is blockingRemote function call is blocking

get()get()

select()select()

RPCReturnValue

Queue

(BoundedBuffer)

RPCReturnValue

Queue

(BoundedBuffer)

CallCall

Return

Val

Return

Val

CallCall

put()put()

RemoteObjectRemoteObjectm1(…)m1(…)

ProxyProxy

T m2(…)T m2(…)

GIPC

Asynchronous

MethodInvoker

GIPC

Asynchronous

MethodInvoker

Factory determines if

asynchronous method

invoker is created

Factory determines if

asynchronous method

invoker is created

Id in Call and Return

Value?

Id in Call and Return

Value?

How many return

value queues and

queue size?

How many return

value queues and

queue size?

Page 30: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

30

GLOBAL RECEIVED VALUE INSTEAD OF BUFFER

processReturnValue(String aSource, Object aMessage)processReturnValue(String aSource, Object aMessage)

wait()wait()

Clear and return received valueClear and return received value

Object returnValueOfRemoteFunctionCall( String aSource, Call aCall)Object returnValueOfRemoteFunctionCall( String aSource, Call aCall)

Received Return Value

Received Return Value

Store return valueStore return value

wait()wait()

Multiple calls

can be made

concurrently to a

server by

different threads

Multiple calls

can be made

concurrently to a

server by

different threads

Page 31: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

31

GLOBAL BOUNDED BUFFER SERVERS

processReturnValue(String aSource, Object aMessage)processReturnValue(String aSource, Object aMessage)

return next value in global (synchronized) bounded buffer

return next value in global (synchronized) bounded buffer

Object returnValueOfRemoteFunctionCall( String aSource, Call aCall)Object returnValueOfRemoteFunctionCall( String aSource, Call aCall)

Put return value in global bounded buffer?

Put return value in global bounded buffer?

Calls return in

same order as

they wait

Calls return in

same order as

they wait

Concurrent calls

can be made to

different callees

Concurrent calls

can be made to

different callees

These would occur

in same order at a

particular callee

These would occur

in same order at a

particular callee

As long as caller

and callee sites

serialize them

As long as caller

and callee sites

serialize them

Page 32: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

32

PER CALLEE BOUNDED BUFFER

processReturnValue(String aSource, Object aMessage)processReturnValue(String aSource, Object aMessage)

return next value in local bounded buffer

return next value in local bounded buffer

Object returnValueOfRemoteFunctionCall( String aSource, Call aCall)Object returnValueOfRemoteFunctionCall( String aSource, Call aCall)

Put return value in local bounded buffer

Put return value in local bounded buffer

Calls return in

same order as

they wait

Calls return in

same order as

they wait

Concurrent calls

can be made to

different callees

Concurrent calls

can be made to

different callees

These would occur

in same order at a

particular callee

These would occur

in same order at a

particular callee

As long as caller

and callee sites

serialize them

As long as caller

and callee sites

serialize them

Local bounded buffer lookup(aDestination)

Local bounded buffer lookup(aDestination)

Local bounded buffer lookup(aSource)

Local bounded buffer lookup(aSource)

Page 33: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

33

METHOD RETURN VALUE

RPCReturnValueRPCReturnValue Object returnValueObject returnValue

No Id sent to match with callNo Id sent to match with call

Page 34: RPC IMPLEMENTATION STEPS - Computer Science · RPC AWARENESS IN APPLICATION: TWO EXTREMES RPC clients and servers handle all aspects of RPC and are completely aware of all of the

34

SUMMARY OF METHOD CALL HANDLING

Synchronization needed between caller and callee.

In GIPC for function calls.

In RMI for both function and procedure calls.

Cannot use shared data structures for synchronization, so use internal messages generated by the RPC system:

AnRPCReturnValue in GIPC,

After sending call message caller invokes a method to wait for synchronization message from callee

In GIPC by blocking on a bounder buffer associated with the callee site

On receiving synchronization message, callee site produces the return value in the bounded buffer associated with callee site