Unit 3
Unit 3
The distributed object model in a distributed system provides a framework for creating
applications where objects can communicate and interact with each other over a
network, even though they may reside on different machines. Here are some key
features of the distributed object model:
1. Transparency
• Access Transparency: Methods are invoked in the same way, whether the
object is local or remote, making remote interactions appear similar to local
ones.
2. Object-Oriented Paradigm
• RMI Registry: A naming service that allows clients to look up remote objects
by name. This service helps in locating and binding to remote objects.
• Directory Services: More advanced directory services can offer features like
object lookup based on attributes and provide a way to organize and manage
objects.
5. Concurrency
• Multi-threading: Distributed object systems often support concurrent
processing, allowing multiple clients to interact with the same remote object
simultaneously.
6. Interoperability
7. Security
• Scalability: Distributed object systems can scale out by adding more servers to
handle increased load.
Designing Remote Method Invocation (RMI) involves several critical issues that must
be addressed to ensure a robust, efficient, and secure system. Here are the primary
design issues associated with RMI:
1. Transparency
• Access Transparency: Ensuring that the distinction between local and remote
objects is minimized, so the client code does not need to be aware of whether
it is invoking a method on a local or a remote object.
• Location Transparency: The client should not need to know the physical
location of the remote object. This is typically handled by naming services like
the RMI registry.
2. Performance
• Latency: Remote method calls introduce network latency, which can affect
performance. Efficient serialization and deserialization, as well as minimizing the
number of remote calls, can help mitigate this.
3. Scalability
• Load Balancing: The system should distribute the workload evenly across
multiple servers to prevent any single server from becoming a bottleneck.
4. Security
6. Object Serialization
• Handling Complex Object Graphs: Dealing with objects that reference other
objects, including handling cyclic references and ensuring the entire object
graph is correctly serialized and deserialized.
7. Garbage Collection
9. Concurrency Control
Addressing these design issues effectively ensures that an RMI system is robust,
scalable, secure, and efficient, providing a seamless experience for developers and
users alike.
Synchronous RPC is the most straightforward form where the client sends a request
to the server and waits for a response, providing simplicity and ease of understanding
but suffering from blocking issues and potential performance bottlenecks, especially
in high-latency networks.
Asynchronous RPC improves upon this by allowing the client to continue execution
without waiting for a response, utilizing callbacks or futures to handle the server's
reply. This non-blocking approach enhances scalability and efficiency but adds
complexity to the client-side code and debugging process.
One-way RPC takes a "fire-and-forget" approach, where the client sends a request
without expecting any response. This method is efficient and reduces network traffic
but lacks confirmation of request processing, making it suitable only for certain use
cases where response validation is unnecessary.
Batch-mode RPC addresses network efficiency by bundling multiple RPC calls into a
single request, reducing the number of round-trips needed. This batching can
significantly improve performance but introduces latency for individual requests and
necessitates sophisticated handling of request and response groups.
Broadcast and Multicast RPC involve sending a single request to multiple servers.
Broadcast RPC targets all servers, while multicast RPC targets a subset. These methods
enhance redundancy and load distribution but increase network traffic and require
mechanisms to handle multiple responses and potential conflicts.
Examples of RPC systems include Sun RPC, DCE/RPC, CORBA, Java RMI, gRPC, XML-
RPC, and JSON-RPC. Each has unique features tailored to specific scenarios, from
simple, language-agnostic communication (XML-RPC, JSON-RPC) to high-
performance, cross-language interactions (gRPC). The choice of RPC mechanism
depends on application requirements such as performance, scalability, security, and
platform compatibility.
Unit -2
5.A) Draw the structure of UDP datagram and explain about various structures
available in JAVA API for UDP transmission.
1. Source Port (16 bits): This is an optional field specifying the port number of
the sending application.
2. Destination Port (16 bits): This field specifies the port number of the receiving
application.
3. Length (16 bits): This field specifies the length of the UDP header and data in
bytes.
4. Checksum (16 bits): This field is used for error-checking of the header and
data.
The data section contains the actual payload to be delivered to the receiving
application. UDP is known for its simplicity and low overhead, but it does not provide
guaranteed delivery, order, or error correction.
Java provides a comprehensive set of classes and interfaces for handling UDP
communication through the java.net package. The primary classes used for UDP
transmission are DatagramPacket and DatagramSocket.
Java provides robust support for TCP (Transmission Control Protocol) stream
communication through its java.net package. TCP is a connection-oriented protocol
that ensures reliable, ordered, and error-checked delivery of data between applications
running on different hosts on a network. In Java, the primary classes used for TCP
communication are Socket, ServerSocket, and InetAddress.
The Socket class represents a client-side socket that can connect to a remote host
over TCP. When creating a Socket object, you specify the remote host's IP address and
port number. The Socket class provides methods for establishing connections, reading
from and writing to the socket, and closing the connection. Once connected, it uses
input and output streams to facilitate data transfer. Specifically, getInputStream() and
getOutputStream() methods return InputStream and OutputStream objects,
respectively, allowing you to read data from and write data to the connection.
The ServerSocket class represents a server-side socket that waits for requests to come
in over the network. It listens on a specific port and establishes a connection with a
client when a request is received. When a client connects, the accept() method of
ServerSocket returns a new Socket object representing the connection to the client.
The server can then interact with the client using the input and output streams
obtained from this Socket object.
3.What is the importance of distributed garbage collection? Explain the Distributed garbage
collector algorithm