Вы находитесь на странице: 1из 6

ISO OSI Reference Model for Layers

CS 194:
Distributed Systems Application
Communication Protocols, RPC Presentation
Session
Computer Science Division Transport
Department of Electrical Engineering and Computer Sciences
University of California, Berkeley Network
Berkeley, CA 94720-1776 Datalink
Physical

EECS122 - UCB 1

Mapping Layers onto


Encapsulation
Routers and Hosts
– Lower three layers are implemented everywhere • A layer can use only the service provided by the layer immediate
below it
– Next four layers are implemented only at hosts
• Each layer may change and add a header to data packet
Host A Host B – higher layer’s header is treated as payload
Application Application data data
Presentation Presentation data data
Session Session data data
Router
Transport Transport data data
Network Network Network
data data
Datalink Datalink Datalink
data data
Physical Physical Physical
data data
Physical medium

OSI Model Concepts Layering: Internet


• Universal Internet layer:
• Service – says what a layer does • Internet has only IP at the Internet layer
• Interface – says how to access the service • Many options for modules above IP
• Protocol – says how is the service • Many options for modules below IP
implemented
Application Telnet FTP DNS
– A set of rules and formats that govern the
communication between two peers
TCP UDP
Transport
Internet IP

Net access/ LAN Packet


Physical radio

1
Application
Transport
Internet’s Hourglass Network
Link
Physical Layer
Physical

Signal
Adaptor
Adaptor Adaptor
Adaptor
Application Layer
• Service: move information between two systems
connected by a physical link
Network Layer
• Interface: specifies how to send a bit
Datalink Layer • Protocol: coding scheme used to represent a bit,
voltage levels, duration of a bit
Physical Layer
• Examples: coaxial cable, optical fiber links;
transmitters, receivers

Application Application
Transport Transport
Network
Link
Datalink Layer Network
Link
Network Layer
Physical Physical

• Service: • Service:
– Framing (attach frame separators)
– Deliver a packet to specified network destination
– Send data frames between peers
– Perform segmentation/reassembly
– Medium access: arbitrate the access to common
– Others
physical media
• Packet scheduling
– Error detection and correction • Buffer management
• Interface: send a data unit (packet) to a • Interface: send a packet to a specified destination
machine connected to the same physical media
• Protocol: define global unique addresses; construct
• Protocol: layer addresses, implement Medium routing tables
Access Control (MAC) (e.g., CSMA/CD)…

Application Application
Transport Transport
Network
Link
Datagram (Packet) Switching Network
Link
Datagram (Packet) Switching
Physical Physical

Host C Host C

Host A Host D Host A Host D

router 1 router 2 router 1 router 2


router 3 router 3

router 5 router 5

Host B Host B
router 7 Host E router 7 Host E
router 6 router 6
router 4 router 4

2
Application
Transport
Network
Link
Transport Layer End-to-End View
Physical

• Services: • Process A sends a packet to process B


– Multiplex multiple transport connections to one network
connection
– Provide an error-free and flow-controlled end-to-end
connection
– Split one transport connection in multiple network Proc. A Proc. B
(port 10) (port 7)
connections Internet
• Interface: send a packet to specify destination
16.25.31.10 128.15.11.12
• Protocols: implement reliability and flow control
• Examples: TCP and UDP

End-to-End Layering View Client-Server TCP


Proc. A Proc. B
(port 10) (port 7)
Internet a) Normal operation of TCP.
16.25.31.10 128.15.11.12
b) Transactional TCP.
2-4

Proc. A Proc. B
(port 10) data data (port 7)

Transport data 10 7 data 10 7 Transport


Network data 10 7 16.25.31.10 128.15.11.12 data 10 7 16.25.31.10 128.15.11.12 Network
Datalink Datalink
Physical Physical
16.25.31.10 Internet 128.15.11.12

Conventional Procedure Call Example: Local Procedure Call

Machine

Process
.
. sum(i, j)
. int i, j;
n = sum(4, 7); {
. return (i+j);
.
.
}

a) Parameter passing in a local procedure call: the stack before the


call to read
b) The stack while the called procedure is active

3
Example: Remote Procedure Call Client and Server Stubs
Stubs • Principle of RPC between a client and server program.
Client Server
Process Process
.
. sum(i, j)
. message message int i, j;
n = sum(4, 7); sum sum {
.
. 4 4 return (i+j);
. 7 7 }

OS OS

Steps of a Remote Procedure Call Parameter Passing


1. Client procedure calls client stub in normal way • Server and client may encode parameters differently
2. Client stub builds message, calls local OS – E.g., big endian vs. little endian
3. Client's OS sends message to remote OS • How to send parameters “call-by-reference”?
4. Remote OS gives message to server stub – Basically do “call-by-copy/restore”
5. Server stub unpacks parameters, calls server – Woks when there is an array of fixed size
6. Server does work, returns result to the stub – How about arbitrary data structures?
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

Different Encodings Parameter Specification and Stub Generation

a) A procedure
b) The corresponding message.

a) Original message on the Pentium


b) The message after receipt on the SPARC
c) The message after being inverted. The little numbers in
boxes indicate the address of each byte

4
Binding a Client to a Server Doors
• The principle of using doors as IPC mechanism.
• Client-to-server binding in DCE.

2-15

RPC Semantics in the Presence of Failures Client is Unable to Locate Server


• The client is unable to locate the server • Causes: server down, different version of server
• The request message from the client to server is lost binary, …
• The reply message from the client is lost • Fixes
• The server crashes after sending a request – Return -1 to indicate failure (in Unix use errno to
indicate failure type)
• The client crashes after sending a request • What if -1 is a legal return value?
– Use exceptions
• Transparency is lost

Lost Request Message Lost Reply Message


• Easiest to deal with • Far more difficult to deal with: client doesn’t know
• Just retransmit the message! what happened at server
• If multiple message are lost then – Did server execute the procedure or not?
– “client is unable to locate server” error • Possible fixes
– Retransmit the request
• Only works if operation is idempontent: it’s fine to execute it
twice
– What if operation not idempotent?
• Assign unique sequence numbers to every request

5
Server Crashes Client Crashes
• Two cases • Let’s the server computation orphan
– Crash after execution • Orphans can
– Crash before execution
– Waste CPU cycles
• Three possible semantics – Lock files
– At least once semantics
– Client reboots and it gets the old reply immediately
• Client keeps trying until it gets a reply
– At most once semantics
• Client gives up on failure
– Exactly once semantics
• Can this be correctly implemented?

Client Crashes: Possible Solutions RPC Semantics: Discussion


• Extermination: • The original goal: provide the same semantics as a
– Client keeps a log, reads it when reboots, and kills the orphan local call
– Disadvantage: high overhead to maintain the log
• Reincarnation:
– Divide times in epochs • Impossible to achieve in a distributed system
– Client broadcasts epoch when reboots
– Dealing with remote failures fundamentally affects
– Upon hearing a new epoch servers kills the orphans
transparency
– Disadvantage: doesn’t solve problem when network partitioned
• Expiration:
– Each RPC is given a lease T to finish computation • Ideal interface: balance the easy of use with making
– If it does not, it needs to ask for another lease visible the errors to users
– If client reboots after T sec all orphans are gone
– Problem: what is a good value of T?

Asynchronous RPC (1) Asynchronous RPC (2)


• A client and server interacting through two
asynchronous RPCs

2-12

a) The interconnection between client and server in a


traditional RPC
b) The interaction using asynchronous RPC

Вам также может понравиться