Lecture 25: Distributed Computing - PowerPoint PPT Presentation

1 / 55
About This Presentation
Title:

Lecture 25: Distributed Computing

Description:

In/out through 'stubs' that marshall and unmarshall at client/server. Binding ... Store needs to know how many objects it can contain ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 56
Provided by: Rand235
Category:

less

Transcript and Presenter's Notes

Title: Lecture 25: Distributed Computing


1
Lecture 25Distributed Computing
  • Prof. Kenneth M. Mackenzie
  • Computer Systems and Networks
  • CS2200, Spring 2003

Includes slides from Bill Leahy
2
Review Network Example
192.168.2.
192.168.2.200
server
100T switch
192.168.1.97
desktop
192.168.1.254
192.168.2.1
desktop
67.33..
10/100 router
DSL modem
ISP
laptop
switch
10T hub
desktop
assigned by DHCP from ISP
static picked by DSL modem
DHCP from DSL modem
static picked by me for the router
printer
192.168.2.201
DHCP from router
static picked by me
3
Review TCP adds reliabilityas does RDP or
Reliable Datagram Protocol in PRJ5
  • RDP API
  • send()
  • recv() (or upcall)
  • Every message sent is received exactly once

User code 1
User code 2
API
send()
recv()
RDP
RDP
IP msgs w/RDP data
IP msg(s) w/ACK
4
Review Breaking TCP/IP
  • TCP Dont cooperate with congestion control
  • TCP SYN flood
  • IP lie to DNS
  • IP induce router table instability
  • ?

5
Word of the Day
  • daemon /day'mn/ or /dee'mn/ (From the
    mythological meaning, later rationalised as the
    acronym "Disk And Execution MONitor") A program
    that is not invoked explicitly, but lies dormant
    waiting for some condition(s) to occur. The idea
    is that the perpetrator of the condition need not
    be aware that a daemon is lurking (though often a
    program will commit an action only because it
    knows that it will implicitly invoke a daemon).

6
Today Distributed Systems
  • How to build distributed applications
  • Basic examples
  • ssh/telnet/rlogin
  • the web
  • RPC a methodology

7
Recall
  • Earlier this term we discussed multiprocessor
    systems (e.g. SMPs)
  • Typically these systems had the processors
    sharing
  • Memory
  • Clock
  • These systems are considered to be tightly
    coupled
  • Today, we discuss the alternative...a loosely
    coupled system

8
What is a distributed system?
  • Nodes interconnected by LAN/WAN
  • LAN
  • Twisted pair, coax, optical fiber, switches
  • WAN
  • Telephone lines, cable, satellites, microwave
    links, wireless, ...
  • Media access protocols
  • ATM, Ethernet, token-passing, point-to-point
    dedicated links, ...

9
Motivation
  • Resource sharing
  • Sites necessarily physically distributed yet need
    to communicate/cooperate
  • Reliability
  • Computation speedup

10
Operating System Typesor levels of ambition
  • Separate computer systems
  • no interconnect (maybe sneakernet)
  • definitely the bad ol days
  • Networked computer systems
  • logically separate systems
  • client-server or peer-to-peer applications
  • ssh, the web, etc.
  • maybe NFS or other file-sharing as well
  • Distributed operating system
  • logically one system
  • physically distributed
  • still rare!

11
How to build distributed applications
  • So far weve provided TCP/IP
  • Client-server using sockets
  • socket() socket()
  • bind() connect()
  • listen()
  • accept()
  • Annoyances
  • communication is ad-hoc atop streams or messages
  • no help for naming

12
/etc/services
ident "_at_()services 1.21 00/11/01 SMI" / SVr4.0
1.8 / Network services, Internet
style tcpmux 1/tcp echo 7/tcp echo 7/udp disc
ard 9/tcp sink null discard 9/udp sink
null systat 11/tcp users daytime 13/tcp daytime
13/udp netstat 15/tcp chargen 19/tcp ttytst
source chargen 19/udp ttytst source ftp-data 20/
tcp ftp 21/tcp telnet 23/tcp smtp 25/tcp mail
time 37/tcp timserver time 37/udp timserver na
me 42/udp nameserver whois 43/tcp nicname
usually to sri-nic domain 53/udp domain 53/tcp b
ootps 67/udp BOOTP/DHCP server bootpc 68/ud
p BOOTP/DHCP client hostnames 101/tcp hostna
me usually to sri-nic pop2 109/tcp pop-2
Post Office Protocol - V2 pop3 110/tcp Post
Office Protocol - Version 3 sunrpc 111/udp rpcbi
nd sunrpc 111/tcp rpcbind imap 143/tcp imap2
Internet Mail Access Protocol v2 ...
13
How do they communicate?
  • What do you think?
  • How would you do it?
  • What might go wrong?

Im over here in Computer A running my
application. I want to pass some information
over to computer B
Computer B should run a certain program using
the data I passed over. When done it should pass
me back the results so I can continue
14
Consider
  • Have name of file
  • char filename
  • Want to open file, read in data, do some
    processing.
  • How do you do it?

15
Now suppose...
  • File is on some remote system
  • What additional things do we have to worry about?

16
How do they communicate?
  • Use messages send(P2, msg)
  • Peer-to-peer messages implemented via message
    kernel
  • Issues
  • Establishing communication port between nodes
  • Buffering messages at sender and receiver
  • Copying to/from address spaces
  • Authentication of messages
  • Send/receive interface too unstructured
  • How to make it more structured?

17
Network Nodes
Application Layer
RPC Layer
Network Layer
Remote Procedure Call
18
RPC in Unix and Protocols
  • User of RPC at the application level
  • e.g. rlogin, rsh, rexec,...
  • RPC package is at the session layer
  • Transport level
  • Transparent to users of RPC
  • May use Shared Memory, UDP or TCP (this has to be
    specified at the time of creation of the socket)
  • Network layer
  • IP
  • Data link and physical layer
  • LAN/WAN

19
Remote Procedure Call
  • Client can run other processes while waiting for
    server to service request
  • Natural interface... just like procedure call
  • Implementation issues?

20
Issues
  • Semantics in the presence of communication
    failures
  • Parameter passing (pointers,)
  • Binding
  • Data transfer protocols
  • Data integrity and security
  • Speed.

21
Addressing these issues
  • Failures
  • At most once semantics
  • Parameters
  • In/out through stubs that marshall and
    unmarshall at client/server
  • Binding
  • Static (fixed at compile/link time)
  • Dynamic (through a name server)
  • Registration and lookup

22
Message is for whom?
  • Port
  • Number attached to a message
  • Can have just one network connection
  • Messages arrive with port number
  • Kernel sends message to appropriate daemon based
    on port number
  • Nameserver
  • Technique to delay binding
  • Nameserver location must be hard-coded

23
client
messages
server
User calls kernel to send RPC message to
procedure X
kernel sends message to nameserver to find port
number
To server From client Port Nameserver Re
Address for RPC X
Nameserver receives message, looks up answer
kernel places port P in user RPC message
To client From server Port kernel Re RPC
X Port P
Nameserver replies to client with Port P
kernel sends RPC
From client To server Port P ltContentsgt
daemon listening to port P receives message
kernel receives reply, passes it to user
From RPC Port P To client Port kernel ltOutputgt
daemon processes request and processes send output
24
RPC Server
  • Upon creation
  • Register name of RPC with the RPC runtime using
    the export mechanism
  • RPC runtime informs name-server of this service
  • RPC runtime at server now ready to service RPC
    calls with this name

25
RPC runtime
user
user stub
server stub
server
call return
pack args unpack result
unpack args pack result
xmit wait rcv
rcv xmit
call exec return
Caller (Client) Node
Callee (Server) Node
Five pieces of program involved
26
RPC
  • User
  • No different from any program making use of
    procedure calls
  • User stub
  • Marshall arguments
  • Identify target procedure
  • Hand over to RPC runtime to deliver to callee
  • Server stub
  • Unmarshall the arguments
  • Make a normal procedure call in server using the
    arguments
  • User and server code part of distributed app
  • Stubs generated automatically

27
Using RPC
  • Writing a distributed computation
  • Interface module (API)
  • Client code that imports the API
  • Server code that exports the API
  • Stub generator generates user-stub and
    server-stub using the API
  • Bind user with user-stub server with server-stub
  • Ready for business.

28
Using RPC
  • Binding
  • Naming
  • What to bind to, compile time decision
  • Location
  • Where to bind to, a runtime decision

29
Naming
  • Type
  • Generic service (mail xfer, file xfer)
  • Instance
  • Particular server from a set of available ones
  • Semantics of the interface name outside the scope
    of RPC package
  • Location of an instance dictated by the RPC
    package

30
Location
  • Early binding
  • Machine address of server hardcoded in the
    application
  • Broadcast to locate a server
  • Too much interference
  • Nameserver
  • e.g.
  • Type file server
  • Instance trantor, cleon
  • Groups and individual

31
RPC runtime
user
user stub
server stub
server
call return
pack args unpack result
unpack args pack result
xmit wait rcv
rcv xmit
call exec return
Caller (Client) Node
Callee (Server) Node
  • Prior to first call
  • export by server
  • import by client gt binding takes place

32
RPC Server
  • Multithreaded
  • Usual to maintain pool of threads to avoid
    thread creation overheads
  • No thread creation overhead unless server gets
    extremely busy and has to spawn new threads

33
RPC Clients
  • Upon startup
  • Register intent to use RPC call via import
  • RPC runtime at client runs around does the
    binding
  • Client makes a normal call after import

34
RPC Clients
  • To make an RPC call
  • Client makes RPC call
  • User-stub creates a call packet
  • Marshalled parameters
  • Name of RPC
  • RPC runtime at client translates name to server
    address and sends call packet to server

35
RPC runtime
user
user stub
server stub
server
call return
pack args unpack result
unpack args pack result
xmit wait rcv
rcv xmit
call exec return
Caller (Client) Node
Callee (Server) Node
  • Steady state
  • RPC serves potentially multiple clients
  • Does the server need to maintain any state
    about the clients it is interacting with?
  • If yes, what state?

36
At Most Once Semantics
  • Client crash and restart
  • RPC at the client gives a new incarnation id to
    the client
  • Client has to rebind to the service
  • Server uses the client id to distinguish this
    instance of the client from the previous one
  • Server crash and restart
  • Server gets a new server id
  • All clients bound to the previous incarnation are
    out of luckthey have to rebind

37
Using RPC
  • Build higher level distributed services
  • NFS
  • SMTP
  • Telnet
  • Web servers
  • Database engines
  • Peer-to-peer servers

38
RPC runtime
user
user stub
server stub
server
call return
pack args unpack result
unpack args pack result
xmit wait rcv
rcv xmit
call exec return
Caller (Client) Node
Callee (Server) Node
39
Network Nodes
Application Layer
RPC Layer
Network Layer
40
Network node
Network node
Network node
Network node
Network node
Network node
41
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
First start up nameserver.
Network node
Network node
Network node
42
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
Store
Store
Store
Then start stores.
Network node
Network node
Network node
Store needs to know how many objects it can
contain and what namespace it will be covering
(i.e. a-m)
43
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
Store
Store
Store
As stores are created they register with
nameserver via RPC calls
Network node
Network node
Network node
44
Basic RPC Process
Store
Nameserver
Application Layer
Network Layer
RPC Layer
45
1. Server exports service which means that RPC
layer creates a table entry containing userid,
service, program, entry point.
Store (Client)
Nameserver (Server)
46
1. Server exports service which means that RPC
layer creates a table entry containing userid,
service, program, entry point. 2. Client imports
service which means it locates host containing
service it desires (stores are created knowing
where to find nameserver). This creates an
activity entry in an activity table which
is pointed to by the server table.
Store (Client)
Nameserver (Server)
47
1. Server exports service which means that RPC
layer creates a table entry containing userid,
service, program, entry point. 2. Client imports
service which means it locates host containing
service it desires (stores are created knowing
where to find nameserver). This creates an
activity entry in an activity table which
is pointed to by the server table.
Store (Client)
Nameserver (Server)
packet
3. Now whenever the client makes an RPC call the
RPC runtime system handles all marshalling of
arguments to be sent in network packets via
the network level.
48
1. Server exports service which means that RPC
layer creates a table entry containing userid,
service, program, entry point. 2. Client imports
service which means it locates host containing
service it desires (stores are created knowing
where to find nameserver). This creates an
activity entry in an activity table which
is pointed to by the server table.
Store (Client)
Nameserver (Server)
3. Now whenever the client makes an RPC call the
RPC runtime system handles all marshalling of
arguments to be sent in network packets via
the network level. 4. The table entries are used
to ensure that the correct instances of server
and client are communicating to yield at once
most execution of the desired service.
49
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
Store
Store
Store
Network node
Network node
Network node
Customer
Supplier
Customer
Client Manager
Client Manager
Customer
Client Manager
Supplier
Customer
Supplier
SHARED MEMORY
SHARED MEMORY
SHARED MEMORY
Client Manager communicates to appropriate
store(s) through RPC calls.
50
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
Store
Store
Store
Network node
Network node
Network node
Customer
Supplier
Customer
Client Manager
Client Manager
Customer
Client Manager
Supplier
Customer
Supplier
SHARED MEMORY
SHARED MEMORY
SHARED MEMORY
In this case Client Manager would be transferring
a file from its node to stores node.
Note In this implementation there is no actual
file transfer. Only in object playing do we
transfer file.
51
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
Store
Store
Store
Network node
Network node
Network node
Customer
Customer
Supplier
Customer
Client Manager
Client Manager
Client Manager
Customer
Supplier
Supplier
SHARED MEMORY
SHARED MEMORY
SHARED MEMORY
Client manager gets appropriate store location
from nameserver.
52
Network node
Network node
Network node
Nameserver ns_register ns_unregister ns_lookup
Store
Store
Store
Network node
Network node
Network node
Customer
Customer
Supplier
Customer
Client Manager
Client Manager
Client Manager
Customer
Supplier
Supplier
SHARED MEMORY
SHARED MEMORY
SHARED MEMORY
Then Client manager communicates with store for
customer. The store is responsible to keep track
of the number of items checked out by the
customer. Done on first call
This is a multi-RPC call process.
53
Shared Memory Detail
6. Client manager using RPC calls gets file
and then transfers it through mailbox
using producer/consumer.
Client Manager
Workpile
Supplier Mailbox
Customer Mailbox
Supplier Mailbox
Customer Mailbox
Supplier Mailbox
Customer Mailbox
...
...
Supplier
Customer
Customer
Supplier
Customer
Supplier
54
Shared Memory Detail
7. Client manager using RPC calls gets file
and then transfers it through mailbox
using producer/consumer.
Client Manager
Workpile
Supplier Mailbox
Customer Mailbox
Supplier Mailbox
Customer Mailbox
Supplier Mailbox
Customer Mailbox
...
...
Supplier
Customer
Customer
Supplier
Customer
Supplier
55
RPC revived .NET
  • .NET includes an RPC-like protocol
  • includes mandatory security check
  • implemented on a new port
  • One could perform the same security with RPC.
    The problem is that there exist deployed RPC
    applications with no security checks. Hence the
    new port .
Write a Comment
User Comments (0)
About PowerShow.com