Understand the main principles of distributed systems
Learn about communication in client-server systems
Learn the concepts of socket programming
Understand Remote Procedure Calls (RPCs)
Explore the use of pipes for interprocess communication
Definition: A distributed system consists of a collection of loosely coupled nodes interconnected by a communication network.
Each node sees its own resources as local while other nodes' resources are seen as remote.
Nodes: Vary in size and function; can include microprocessors, personal computers, and large computer systems.
Terminology: Nodes can be referred to as processors, sites, machines, or hosts, with 'site' indicating location and 'node' indicating the specific system.
Typically, one node (the server) has a resource that another node (the client) wishes to access.
Resource Sharing: Users can access resources from different sites (e.g., printing documents located remotely).
Computation Speedup: Distributing sub-computations allows for concurrent execution and load balancing across sites.
Reliability: Failure of one site does not affect the operation of the rest, enhancing overall system reliability through redundancy.
Communication: Enables information exchange between users and nodes, facilitating activities such as file transfers and remote procedure calls (RPCs).
Reliability: High fault tolerance
Scalability: Can scale with increased resources
Flexibility: Adaptable to various configurations and needs
Speedup: Multiple processes can run simultaneously
Openness: Can integrate heterogeneous systems
High Performance: Improved speed and efficiency in processing
Difficult Troubleshooting: Harder to diagnose problems
Less Software Support: Limited resources for distributed applications
High Network Infrastructure Costs: Expensive to set up robust networks
Security Issues: Increased vulnerabilities across the system
A program during execution is termed a process.
Inter-process Communication (IPC): Defined by the OS for processes running on the same host.
For processes on different hosts, they communicate through message passing across a communication network.
Roles: The initiating process is the client; the waiting process is the server.
Definition: Sockets allow client and server processes to communicate by reading from and writing to them, functioning similarly to doors.
Communication Process:
Messages sent from a sending process through a socket are delivered to the receiving process's socket via the network.
The destination address includes both the IP address and port number for routing.
Destination Address: Consists of the destination host's IP and the port number of the receiving application.
Source Address: Comprises the source host IP and source port number, typically managed by the OS.
Types:
UDP (User Datagram Protocol): Connectionless, unreliable, message-oriented.
TCP (Transmission Control Protocol): Connection-oriented, reliable, byte-stream oriented.
UDP Client-Server:
No prior connection establishment.
Each packet sent contains attached IP and port details.
Data can be lost or received out-of-order.
TCP Client-Server:
Client contacts the server which must be actively running.
TCP provides reliable communication, supporting multiple clients by creating new sockets for each connection.
UDP Client/Server:
Client sends a message, server receives and modifies it, sending it back.
TCP Client/Server:
Similar communication using the TCP protocol ensuring order and reliability.
EchoServer and Single Client Knock-Knock Application demonstrate client-server interactions with TCP using echoing messages or jokes.
Definition: RPCs enable a client to invoke procedures on remote hosts as if they are local calls.
Mechanism: Involves stubs on both client and server to manage communication details, including parameter marshaling and message transmission.
Purpose: Channels for interprocess communication.
Ordinary Pipes: Unidirectional, requiring a parent-child relationship.
Named Pipes: Bidirectional, allowing multiple processes to communicate, even over networks.
Ordinary pipes in UNIX use pipe(int fd[])
, where fd[0]
is the read-end and fd[1]
is the write-end.