Download Introduction

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Expense and cost recovery system (ECRS) wikipedia , lookup

Concurrency control wikipedia , lookup

Asynchronous I/O wikipedia , lookup

Transcript
RPC
Tanenbaum & Van Steen,
Distributed Systems: Principles and
Paradigms 2/e
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Communication in distributed systems
Always based on low-level message passing as offered
by the Under lying network
widely-used models for communication
–
Remote procedure call(RPC)
–
–
Aims at hiding most of the intricacies of message passing
Low level communication facilities of computer networks are not suitable Lack of
distribution transparency
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Layered protocols
Lower-level protocols
– physical layer is transmitting the 0s and 1s
– data link is putting bit pattern and computing a checksum
by adding up all the bytes in the frame in a certain way
– Network layer is a part of the internet protocol suite. IP
packet exchanging
Transport protocols
–
forms the last part of what could be called a basic
network protocol stack, some packets can be lost on the
way from the send to receiver. Some application can
handle their own error recovery
–
Is to provide this service.
Additional transport protocols are regularly proposed;
Real-time Transport protocol(RTP)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Layered protocols
Higher-level protocols
–
Session layer is essentially and enhanced version of the transport
layer. It provides dialog control, to keep track of which party is currently
talking and synchronization
–
Presentation layer is concerned with the meaning of
the bit; structured information
–
Application layer become the container for all applications
–
Form the perspective virtually all distributed systems are just
applications.
Application-specific protocols ; http, ftp…
Middleware protocols
–
–
lives in application layer but more specific applications
A distinction can marked between high-level communication protocols
and protocols for establishing's various middleware service.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Layered Protocols (1)
Layers, interfaces, and protocols
in the OSI model.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Layered Protocols (2)
A typical message as it appears on the network.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Middleware Protocols
An adapted reference model
for networked communication.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Types of Communication
Viewing middleware as an intermediate (distributed) service in
application-level communication. Email service
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Client and Server Stubs
Principle of RPC between a client and server program.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Client and Server Stubs
Client Server stub
The idea behind RPC is to make procedure call look as much as
possible like a local one
Call to a READ in the code to get the data, the read routine is
extracted form the library and insert into the object program.
The READ procedure(Stub) is a kind of interface between the user code
and local OS.
The call to send, the client stub calls receive, blocking itself until
the reply comes back
When the message arrives at the server, the server’s OS passes it up to a
server stub.
A server stub is the server-side equivalent of a client stub
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Remote Procedure Calls (1)
A remote procedure call occurs in the following
steps:
1.
2.
3.
4.
5.
The client procedure calls the client stub in the normal
way.
The client stub builds a message and calls the local
operating system.
The client’s OS sends the message to the remote OS.
The remote OS gives the message to the server stub.
The server stub unpacks the parameters and calls the
server.
Continued …
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Remote Procedure Calls (2)
A remote procedure call occurs in the following
steps (continued):
6.
The server does the work and returns the result to the
stub.
7. The server stub packs it in a message and calls its local
OS.
8. The server’s OS sends the message to the client’s OS.
9. The client’s OS gives the message to the client stub.
10. The stub unpacks the result and returns to the client.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Passing Value Parameters (1)
Figure 4-7. The steps involved in a doing a
remote computation through RPC.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Parameter Specification
and Stub Generation
. (a) A procedure. (b) The corresponding message.
Caller and callee agree on the format of the messages they exchange and they
follow the same steps when it comes to passing complex data structures
Both sides in an RPC should follow the same protocol otherwise the RPC will not
work correctly
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
RPC (1)
The interaction between client and
server in a traditional RPC.
As interface is usually
available in the same
programming language
as the one in which the
client or sever is written
By means of an
Interface Definition
Language(IDL)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Asynchronous RPC (2)
– When a client calls a remote procedure the client
will block until are replies returned
– Unnecessary when there is no result return;
adding entries into a database, transferring money
from one account to another, batch processing…
– To support this situation, RPC systems may
provide facilities for what are called asynchronous
RPCs.
(Server’s acknowledgement for client requirement)
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Asynchronous RPC (2)
The interaction using asynchronous RPC.
It also called as deferred synchronous RPC
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Asynchronous RPC (3)
A client and server interacting through
two asynchronous RPCs.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Ex. DCE RPC
RPCs have been widely adopted as the basis of middleware and
distributed systems
Good example Distributed computing enviroment(DEC)
–
–
-Developed by the Open Software Foundations(OSF)
-Ref Sun RPC vs MS’ Decom
It consists of many components; language, libraries, daemons and
utility programs.
Together these make it possible to write clients and servers.
In CS system, everything tied together with Interface Definition
Language
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Writing a Client and a Server (1)
. The steps in writing a client and a server in DCE RPC.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Writing a Client and a Server (2)
When the IDL file is complete, the IDL compiler
is called to process it.
Three files output by the IDL compiler:
•
A header file (e.g., interface.h, in C terms).contains the unique identifier, type definition constant definition and
function prototypes
•
The client stub. – contains the actual procedures that
the client program will call
•
The server stub. – contains the procedures called by
the runtime system on the server
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Binding a Client to a Server (1)
•
•
•
To allow a client to call a server, necessary
that the server be registered and prepared to
accept incoming calls.
Registration of a server makes it possible for
a client to locate the server and bind to it.
Server location is done in two steps:
1. Locate the server’s machine.
2. Locate the server on that machine.
-second step is subtle and client needs to know an
end point
-In DCE a tale of pairs is maintained by DEC Daemon
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5
Binding a Client to a Server (2)
Client-to-server binding in DCE.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved. 0-13-239227-5