Академический Документы
Профессиональный Документы
Культура Документы
Outline
Protocol Stack
Presentation Formatting
Spring 2002
CS 461
RPC Timeline
Client
Server
Blocked
Blocked
Computing
Blocked
Spring 2002
CS 461
RCP Components
Protocol Stack
BLAST: fragments and reassembles large messages
CHAN: synchronizes request and reply messages
SELECT: dispatches request to the correct process
Stubs
Caller
(client)
Arguments
Return
value
Client
stub
Request
Arguments
Return
value
Server
stub
Reply
RPC
protocol
Spring 2002
Callee
(server)
Request
Reply
RPC
protocol
CS 461
Sender
Receiver
Strategy
selective retransmission
aka partial
acknowledgements
Spring 2002
CS 461
BLAST Details
Sender:
after sending all fragments, set timer DONE
if receive SRR, send missing fragments and reset DONE
if timer DONE expires, free fragments
Spring 2002
CS 461
Spring 2002
CS 461
Spring 2002
CS 461
16
31
ProtNum
MID
Length
NumFrags
Type
FragMask
Data
Request/Reply (CHAN)
Guarantees message delivery
Synchronizes client with server
Supports at-most-once semantics
Simple case
Client
Spring 2002
Server
Implicit Acks
Client
CS 461
Server
CHAN Details
Lost message (request, reply, or ACK)
set RETRANSMIT timer
use message id (MID) field to distinguish
Spring 2002
CS 461
/*
/*
/*
/*
/*
/*
typedef struct {
u_char
type;
u_char
status;
int
retries;
int
timeout;
XkReturn ret_val;
Msg
*request;
Msg
*reply;
Semaphore reply_sem;
int
mid;
int
bid;
} ChanState;
Spring 2002
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
CLIENT or SERVER */
BUSY or IDLE */
number of retries */
timeout value */
return value */
request message */
reply message */
client semaphore */
message id */
boot id */
CS 461
10
Synchronous vs Asynchronous
Protocols
Asynchronous interface
send(Protocol llp, Msg *message)
deliver(Protocol llp, Msg *message)
Synchronous interface
call(Protocol llp, Msg *request, Msg *reply)
upcall(Protocol hlp, Msg *request, Msg *reply)
Spring 2002
CS 461
11
Dispatcher (SELECT)
Dispatch to appropriate
procedure
Synchronous counterpart
to UDP
Implement concurrency
(open multiple CHANs)
Caller
(client)
Callee
(server)
call
upcall
SELECT
SELECT
call
upcall
CHAN
send
CHAN
deliver
send
deliver
CS 461
12
CHAN
BLAST
IP
ETH
Spring 2002
CS 461
13
SunRPC
IP implements BLAST-equivalent
SunRPC
UDP
IP
Spring 2002
CS 461
ETH
14
Spring 2002
(a)
31
31
XID
XID
MsgType = CALL
MsgType = REPLY
RPCVersion = 2
Program
(b)
Status = ACCEPTED
Data
Version
Procedure
Credentials (variable)
Verifier (variable)
Data
CS 461
15
Presentation Formatting
Marshalling (encoding)
application data into
messages
Unmarshalling (decoding)
messages into application
data
Application
data
Application
data
Presentation
encoding
Presentation
decoding
integers
floats
strings
arrays
structs
Spring 2002
CS 461
16
Difficulties
Representation of base types
floating point: IEEE 754 versus non-standard
integer: big-endian versus little-endian (e.g., 34,677,374)
(2)
Big-endian
(17)
(34)
(126)
00100010
01111110
(34)
(17)
(2)
00100010
00010001
00000010
00000010 00010001
(126)
Little-endian 01111110
Low
address
High
address
Spring 2002
CS 461
17
Taxonomy
Data types
base types (e.g., ints, floats); must convert
flat types (e.g., structures, arrays); must pack
complex types (e.g., pointers); must linearize
Argument marshaller
Conversion Strategy
canonical intermediate form
receiver-makes-right (an N x N solution)
Spring 2002
CS 461
18
Taxonomy (cont)
Tagged versus untagged data
type =
len = 4
INT
value = 417892
Stubs
compiled
interpreted
Interface
descriptor for
procedure P
Call P
Arguments
Client
stub
Code
Specification
Stub
compiler
Code
Arguments
Server
stub
Marshalled
arguments
Marshalled
arguments
RPC
RPC
Message
Spring 2002
CS 461
19
Spring 2002
CS 461
20
Name
List
3
Spring 2002
4 97
8 321
CS 461
2 65
21
An ISO standard
Essentially the C type system
Canonical intermediate form
Tagged
Compiled or interpretted stubs
BER: Basic Encoding Rules
(tag, length, value)
type length type length
value
type length
value
value
INT
Spring 2002
4-byte integer
CS 461
22
IntegrRep CharRep
Spring 2002
IntegerRep
0 = big-endian
1 = little-endian
CharRep
FloatRep
16
FloatRep
0 = ASCII
1 = EBCDIC
0 = IEEE 754
1 = VAX
2 = Cray
3 = IBM
24
Extension 1
CS 461
31
Extension 2
23