Distributed Systems Flashcards
• The main principles of distributed systems • Communication in client-server systems • Socket programming • Remote Procedure Calls • Pipes
Main principles of distributed
systems
A distributed system is a collection of loosely coupled nodes
interconnected by a communication network.
* From the point of view of a specific node in a distributed system, its own
resources are local, whereas the rest of the nodes and their respective
resources are remote.
* The nodes in a distributed system may vary in size and function (i.e.
small microprocessors, personal computers, and large general-purpose
computer systems).
* They are also referred to by a number of names (i.e. processors, sites,
machines, and hosts) depending on the context in which they are
mentioned.
* We mainly use site to indicate the location of a machine and node to
refer to a specific system at a site
* Generally, one node at one site, the server, has a resource that another
node at another site, the client (or user), would like to use.
Why do we need Distributed
Systems?
- Resource Sharing
- Computation Speedup
- Reliability
- Communication
Why do we need Distributed
Systems?Resource Sharing
A user at one site may be able to use the resources
available at another. For example, a user at site A may be using a laser
printer located at site B. Meanwhile, a user at B may access a file that
resides at A.
Why do we need Distributed
Systems?Computation Speedup
Subcomputations can be distributed among the
various sites and run concurrently. If a particular site is overloaded, jobs
can be moved to other sites (load sharing or job migration
Why do we need Distributed
Systems?Reliability
If one site fails in a distributed system, the remaining sites
can continue operating, giving the system better reliability. With enough
redundancy (in both hardware and data), the system can continue
operation, even if some of its sites have failed
Why do we need Distributed
Systems?Communication
Users at the various sites can exchange information. At
a low level, messages are passed between systems. All higher-level
functionality of a standalone systems can be expanded to encompass
the distributed system (i.e. file transfer, login, mail, and remote
procedure calls (RPCs)
Advantages of
Distributed Systems
- Reliability, high fault tolerance
- Scalability
- Flexibility
- Speedup
- Openness
- High performance
disadvantages of
Distributed Systems
- Difficult troubleshooting
- Less software support
- High network infrastructure costs
- Security issues
Processes communicating
- A program while executing is a processes.
- Processes communicate within the same host using inter-
process communication defined by the OS. - Processes communicate in different end systems (potentially
running different OSs) by exchanging messages across a
communication network. - The process that initiates the communication (that is,
initially contacts the other process at the beginning of the
session) is labelled as the client. The process that waits to
be contacted to begin the session is the serve
Sockets
A client and server process communicate through sockets, which are similar to doors. Sending processes push messages out of the sender’s socket, using transport infrastructure to deliver them to the receiving process. The destination address includes the destination host’s IP address and port number, which routers use to route packets. The sender’s source address includes the source host IP address and source socket port number. The source address is typically automatically attached by the operating system.
Socket programing
Two socket types for two transport services:
* UDP (User Datagram Protocol)
* connectionless, unreliable
* Message oriented – group of bytes (“datagram”) is sent
through the socket
* TCP (Transmission Control Protocol)
* connection-oriented, reliable
* Byte Stream oriented – stream of bytes is sent through
the socket
Client-Server application using UDP
- no “connection”
between client & server
(no handshaking before
sending data - sender explicitly
attaches IP destination
address and port # to
each packet - receiver extracts sender
IP address and port#
from received packet - transmitted data may be
lost or received out-of-
order
Client-Server application using TCP
client must contact server
* server process must first be running
* server must have created socket (door) that
welcomes client’s contact
client contacts server by:
* Creating TCP socket, specifying IP address,
port number of server process
* when client creates socket: client TCP
establishes connection to server TCP
* when contacted by client, server TCP creates
new socket for server process to
communicate with that particular client
* allows server to talk with multiple clients
(source port numbers used to distinguish
clients)
* TCP provides reliable, in-order byte-stream
transfer between client and serve
Remote Procedure Calls
Remote Procedure Calls (RPCs)
* RPCs allow a client to invoke a procedure on a remote host
as it would invoke a procedure locally.
* The RPC system hides the details that allow communication
by providing a stub on both remote hosts (client and
server).
Remote Procedure Calls steps
- client invokes a remote procedure. RPC
system calls the appropriate stub, passing
it the parameters provided to the remote
procedure. - client stub locates the port on the
server and marshals the parameters
(packaging the parameters into a form
that can be transmitted over a network). - client stub transmits a message to the
server using message passing.
4-5. server stub receives this message and
invokes the procedure on the server.
6-10. return values are passed back to the
client using the same technique
Pipes
Pipes
A pipe acts as a channel allowing two processes to communicate
(interprocess communication).
* Ordinary pipes
* Allow communication in standard producer-consumer style.
* Producer writes to one end (the write-end of the pipe).
* Consumer reads from the other end (the read-end of the pipe).
* Ordinary pipes are unidirectional.
* Require parent-child relationship between communicating
processes.
* Named pipes
* Named Pipes are more powerful than ordinary pipes.
* Communication is bidirectional.
* Several processes can use the named pipe for communication.
* Allows interprocess communication over a network.