Lecture 26
Review/Preview
have now seen message passing and distributed parallel computing
message passing is great for filters and peers, but it is somewhat
low level for client server
now we are going to look at distributed SYSTEMS
these make heavy use of client/server interactions and also use peers
we are going to look at RPC and rendezvous, examples, and tools
big picture -- figure at bottom of page 292
busy waiting
semaphores
monitors message passing
RPC rendezvous
RPC and rendezvous: procedure interface; message passing implementation
Modules -- Section 8.1 (classes in Java; resources in SR)
module name
operations # interface
body
vars, procs, processes
end
can be distributed => different modules can execute on different machines
RPC and Rendezvous -- the basic idea
(see little figures on pages 364 and 374)
Client side: Server side:
op name(formals) # in the interface
(1) call name(actuals) --->
proc name(formals)
execute body
end
<---
continue on
this is remote procedure call (RPC): a NEW process (thread)
is created to service the call. why a new thread?
(2) process server
....
in foo(formals) ->
call name(actuals) ---> # wait for call
execute body
ni
<--- reply to call AND continue execution
this is rendezvous: interact with an EXISTING process
Implementation Sketch (so they get an idea how this stuff actually works)
see Chapter 10 for details
RPC -- there is no op queue because there are never pending calls
(assuming there is no limit on new threads)
caller: when "call" arrives at server machine:
evaluate args create a thread
pack into a message the thread does a local call, which
send to server eventually sends a reply to the caller
receive reply
unpack results into vars
Rendezvous
caller: when "call" arrives at server machine:
same actions as for RPC put on ope queue OR awaken server
the server process "receives" from the
op queue
after servicing a call, the server sends
a reply message to the client
RPC Examples
Time server -- Section 8.1.2, Figure 8.1
ops -- get_time() and delay()
body of module -- 2 procedures PLUS a background process for the Clock
need local synchronization -- how?
use semaphores (SR) or synchronized methods (Java)
Distributed File System -- Section 8.1.3, Figures 8.2 (a) and 8.2 (b)
I drew a block diagram of modules, client process and interaction
again need local synchronization
also need a way to place modules on hosts
Java RMI -- Remote Method Invocation
compile the programs javac
generate a stub and a skeleton for the server(s) rmic
(these handle the implementation described above)
start the registry service rmiregistry
it keeps track of names and creates sockets and such
start server on its host java
start client on its host java
the parts are compiled as if in one program, but they start separately
and use the registry server to "connect" with each other