Distributed Objects in Distributed Systems
Introduction to Distributed Objects
- Distributed Computing: Involves multiple computers or nodes working together to achieve a common task.
- Focus on Distributed Objects: Core components that enable the distribution of methods and data.
Key Concepts in Distributed Systems
- Remote Procedure Calls (RPC): Allows client programs to call procedures on server programs.
- Remote Method Invocation (RMI): Objects invoke methods of objects located on different hosts.
- Event-based Programming Model: Objects receive notifications about events occurring in other objects.
Middleware
- Definition: Software that bridges different applications or layers, enabling them to communicate.
- Functions of Middleware:
- Facilitates communication between processes and message passing.
- Operates with multiple protocols and APIs.
Middleware Layers
- Layers involved:
- Request-Reply Protocol
- External Data Representation
- Operating System Interfacing
- Modules like RMI, RPC, and events.
Benefits of Middleware
- Location Transparency: Remote objects appear as local, simplifying client-server interactions.
- Communication Protocols: Clients do not need to be aware of underlying network protocols (UDP vs TCP).
- Operational Consistency: Differences in data representation across hardware/OS are abstracted away.
- Programming Language Flexibility: Supports interactions between different programming languages for clients and servers.
Interfaces in Distributed Systems
- Defined as modules with strict communication protocols.
- Implementation is not mandatory on the consuming side, promoting modularity.
Types of Interfaces
- Service Interface: List of available procedures for clients.
- Remote Interface: Definition of remote objects and their accessible methods with input/output arguments.
Object Interfaces
- Interfaces denote method signatures (arguments, return values, exceptions) without implementation details.
- They do not have constructors or data.
Interface Definition Languages (IDL)
- Purpose: Specifies parameters, argument types to define remote objects.
- Provides a common specification to facilitate interoperability across programming languages.
CORBA IDL Example
struct Person {
string name;
string place;
long year;
};
interface PersonList {
readonly attribute string listname;
void addPerson(in Person p);
void getPerson(in string name, out Person p);
long number();
};
Object Model in Distributed Computing
- Objects include state (data) and behavior (methods).
- Often represent real-world entities but can encapsulate more abstract concepts.
Object References
- Objects accessed through references and can be:
- Assigned to variables.
- Passed as parameters in method calls.
- Returned as method results.
Actions in Object-Oriented Programming
- Actions triggered by object methods can:
- Change the object’s state.
- Instantiate new objects.
- Trigger further method invocations.
- Raise exceptions for error handling.
Exception Handling
- Allows the program to manage unexpected conditions without crashing.
- Uses a try-catch mechanism to handle errors gracefully.
Garbage Collection
- Method for automatically freeing memory of unused objects.
- Implemented in languages like Java, while C++ requires manual handling by the programmer.
Remote Method Invocation (RMI)
- Enables methods of remote objects to be invoked over a network.
- Remote objects must be accessible via a remote reference.
Differences between RMI and General RMIs
- Java RMI is specific to Java; broader RMI is language-agnostic.
- Confusion may arise if using the term RMI generically.
Fault Tolerance in Distributed Systems
- Mechanisms to manage errors within systems, including:
- Acknowledging errors in client, server, or network.
- Requires distinct strategies for handling reliability.
Fault Tolerance Strategies
- Retry Request Message: Retransmits requests until a response is clear.
- Duplicate Filtering: Manages multiple identical requests.
- Result Retransmission: May resend results rather than re-executing requests.
Invocation Semantics
- Maybe: Requests may execute once or not at all (common in failures).
- At-least-once: Guarantees execution at least once but risks duplication.
- At-most-once: Ensures execution exactly once without duplicates.
Communication Modules
- Communication Module: Handles message transmission and request processing.
- Remote Reference Module: Translates between remote and local references, sustaining a table of references.
Proxy, Dispatcher, and Skeleton
- Proxy: Local representation of a remote object.
- Dispatcher: Chooses the method for a received request.
- Skeleton: Receives a network call, connecting it to the remote object.
Binder in Distributed Systems
- A service that maps client requests to server object references (e.g., Java's RMI registry).
Events and Notifications in Distributed Systems
- Events: Actions causing changes in object states.
- Notifications: Alerts sent to objects when an event occurs.
Publish-Subscribe Model
- Clients subscribe to servers for event updates.
- Allows selective notifications based on client interests.
Observers
- Intermediate objects that manage event notifications for subscribers:
- Handle bulk notifications.
- Filter and prioritize messages.
- Store notifications until the subscriber is ready.
Example of Event Notification
- The object can publish directly or through an observer, allowing flexible handling of updates.