0% found this document useful (0 votes)
9 views

Unit 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Unit 2

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

1.A) List and explain the characteristics of inter-process communication?

Inter-process communication (IPC) in distributed systems is characterized by several key


attributes that enable processes running on different machines to communicate and
coordinate their actions.

Transparency

Transparency ensures that the underlying communication mechanisms are hidden


from the application, allowing processes to interact as if they were on the same
machine. This abstraction simplifies the development process and makes the
distributed system more user-friendly.

Scalability

Scalability is a critical feature that ensures IPC mechanisms can handle an increasing
number of processes and communication demands without significant performance
degradation. Effective IPC systems must efficiently manage resources and maintain
performance as the system grows.

Fault Tolerance

Fault tolerance is vital for ensuring that communication can continue even in the face
of failures. Techniques like message retries, replication, and alternative routing paths
help maintain reliable communication and system robustness.

Latency and Bandwidth

Latency and bandwidth considerations are crucial for ensuring timely and efficient data
transfer. Distributed systems often operate over wide-area networks where these
factors can vary significantly. Minimizing latency and optimizing bandwidth usage are
essential for maintaining high performance.

Security

Security is a fundamental characteristic involving authentication, authorization, and


encryption to protect data exchanged between processes from unauthorized access
and tampering. Secure IPC mechanisms prevent data breaches and ensure that
communication remains confidential and integrity is maintained.

Synchronization

Synchronization mechanisms ensure that processes can coordinate their actions and
maintain consistency, especially in operations that require multiple processes to work
together. Effective synchronization prevents race conditions and ensures coherent
system behavior.

Heterogeneity
Heterogeneity must be addressed as distributed systems often involve different
hardware, operating systems, and network protocols. IPC mechanisms need to be
adaptable and interoperable across diverse environments to ensure seamless
communication between heterogeneous components.

1.B) Explain the client server communication model. Also Discuss about
marshaling in detail.

Client and Server model

o A client and server networking model is a model in which computers such as


servers provide the network services to the other computers such as clients to
perform a user based tasks. This model is known as client-server networking
model.

o The application programs using the client-server model should follow the given
below strategies:

o An application program is known as a client program, running on the local


machine that requests for a service from an application program known as a
server program, running on the remote machine.
o A client program runs only when it requests for a service from the server while
the server program runs all time as it does not know when its service is required.

o A server provides a service for many clients not just for a single client. Therefore,
we can say that client-server follows the many-to-one relationship. Many clients
can use the service of one server.

o Services are required frequently, and many users have a specific client-server
application program. For example, the client-server application program allows
the user to access the files, send e-mail, and so on. If the services are more
customized, then we should have one generic application program that allows
the user to access the services available on the remote computer.

Client

A client is a program that runs on the local machine requesting service from the server.
A client program is a finite program means that the service started by the user and
terminates when the service is completed.

Server

A server is a program that runs on the remote machine providing services to the clients.
When the client requests for a service, then the server opens the door for the incoming
requests, but it never initiates the service.

Marshalling:
Marshalling in distributed systems involves transforming data structures or objects
into a format suitable for transmission over a network and then reconstructing them
at the destination. Here's a breakdown of how marshalling works and why it's essential:

What is Marshalling?

Marshalling is the process of converting data structures or objects into a format that
can be easily transmitted between different components in a distributed system. This
typically involves:

1. Serialization: Converting complex data types (like objects) into a sequence of


bytes or a text format.

2. External Data Representation: Ensuring the data can be correctly interpreted


by different systems that may use different internal representations.

Approaches to Marshalling

1.CORBA (Common Object Request Broker Architecture):


CDR (Common Data Representation): Defines how data types are represented for
CORBA distributed objects.

Components:

ORB (Object Request Broker): Manages communication between objects.

IDL (Interface Definition Language): Specifies interfaces for distributed objects.

DII (Dynamic Invocation Interface): Allows dynamic method invocation.

IR (Interface Repository): Stores interface descriptions.

OA (Object Adapter): Provides access to ORB services.

Example: A Person struct with fields name, place, and year would be marshalled
according to CDR rules.

2.Java Object Serialization:

• Converts Java objects into a sequence of bytes.

• Supports saving objects to disk or sending over a network.

• Provides mechanisms to recreate the object with its type information.

• Example: An object with fields name, place, and year is serialized into
bytes and can be deserialized back into the original object.

3.XML (Extensible Markup Language):

• Represents data in a text-based format.

• Suitable for web services and data interchange between systems.

• Example: A Person object might be represented as

<Person>

<name>John</name>

<place>NY</place>

<year>1990</year>

</Person>.

2.A) Illustrate the necessary and sufficient conditions for causal ordering.

Causal ordering of messages is one of the four semantics of multicast communication


namely unordered, totally ordered, causal, and sync-ordered communication.
Multicast communication methods vary according to the message’s reliability
guarantee and ordering guarantee. The causal ordering of messages describes the
causal relationship between a message send event and a message receive event.

For example, if send(M1) -> send(M2) then every recipient of both the messages M1
and M2 must receive the message M1 before receiving the message M2. In Distributed
Systems the causal ordering of messages is not automatically guaranteed.

Reasons that may lead to violation of causal ordering of messages

1. It may happen due to a transmission delay.

2. Congestion in the network.

3. Failure of a system.

Protocols that are used to provide causal ordering of messages

1. Birman Schipher Stephenson Protocol

2. Schipher Eggli Sandoz Protocol

Both protocol’s algorithm requires that the messages be delivered reliably and both
prefer that there is no network partitioning between the systems. The general idea of
both protocols is to deliver a message to a process only if the message immediately
preceding it has been delivered to the process. Otherwise, the message is not delivered
immediately instead it is stored in a buffer memory until the message preceding it has
been delivered.

Necessary and Sufficient Conditions for Causal Ordering

1. Causal Relationship

Necessary Condition: For two events e1e1 and e2e2 in a distributed system, if e1e1
causally affects e2e2, then e1e1 must occur before e2e2 in any causal ordering.

Sufficient Condition: A causal ordering is correct if it respects all causal relationships


between events. This means that if e1e1 causally affects e2e2, then e1e1 must precede
e2e2 in the ordering.

2. Happens-Before Relationship

Necessary Condition: The happens-before relationship is a fundamental concept for


defining causal order. Event e1e1 happens-before event e2e2 (denoted as
e1→e2e1→e2) if:

• e1e1 and e2e2 are in the same process, and e1e1 occurs before e2e2.

• e1e1 is the sending of a message, and e2e2 is the receipt of that message in the
same process.

• e1e1 happens-before e2e2 transitively through a chain of events (i.e., if


e1→e2e1→e2 and e2→e3e2→e3, then e1→e3e1→e3).

Sufficient Condition: For a total ordering of events to be a valid causal ordering, it


must respect the happens-before relationships. If e1→e2e1→e2, then e1e1 should
appear before e2e2 in the ordering.

3. Consistency Across Processes

Necessary Condition: Causal ordering must be consistent across all processes in the
distributed system. This means that all processes should agree on the order of events
based on their causal relationships.

Sufficient Condition: If a total ordering of events respects the causal relationships


and happens-before constraints, it is consistent across processes. This ensures that all
processes view the causal relationships similarly.

4. No Causality Violations

Necessary Condition: A causal ordering must not violate causality. If two events are
causally related, their order should not be inverted. For example, if e1e1 causally affects
e2e2, then e2e2 should not precede e1e1 in the ordering.
Sufficient Condition: An ordering that maintains the correct sequence of causally
related events and respects the happens-before relationship is free from causality
violations.

Example

Consider three events in a distributed system:

1. Event A in Process 1 sends a message to Process 2.

2. Event B in Process 2 receives the message from Process 1.

3. Event C in Process 2 is a local event.

To ensure causal ordering:

• Causal Relationship: Event A must come before Event B because A causes B.

• Happens-Before: A → B, meaning A happens before B in the ordering.

• Consistency: Any valid ordering must reflect that A happens before B, and B
happens before C if C depends on B.

• No Violations: The ordering should not place B before A or C before B if C


depends on B.

2.B) What are sockets? How does they used in IPC in distributed systems

Sockets are a fundamental technology used in networking and inter-process


communication (IPC). Here’s a brief overview of what they are and how they are used
in distributed systems:

What Are Sockets?

A socket is an endpoint for sending or receiving data across a network. It provides a


way for software applications to communicate with each other over a network, whether
it's within a single machine or across multiple machines. In essence, a socket is a
combination of an IP address and a port number, which allows for communication
between processes.

How Are Sockets Used in IPC in Distributed Systems?

1. Inter-Process Communication (IPC):

• Local IPC: Within a single machine, sockets can be used for


communication between different processes. For instance, one process
might use a socket to send data to another process on the same
machine, using Unix domain sockets.
• Remote IPC: For communication across different machines, sockets use
network protocols such as TCP/IP. This is common in distributed systems
where processes on different machines need to interact.

2. Client-Server Model:

• Server: A server process opens a socket, binds it to a specific port, and


listens for incoming connection requests.

• Client: A client process creates a socket, connects it to the server's IP


address and port number, and communicates with the server.

3. Data Transmission:

• TCP (Transmission Control Protocol): Provides reliable, ordered, and


error-checked delivery of data between applications. It establishes a
connection before data is sent.

• UDP (User Datagram Protocol): Provides a simpler, connectionless


communication model. It's faster but does not guarantee delivery, order,
or error-checking.

4. Distributed Systems:

• In a distributed system, multiple processes running on different


machines communicate using sockets. For example, a distributed
application might use sockets to synchronize data between servers or to
coordinate tasks across different nodes.

5. Concurrency:

• To handle multiple connections simultaneously, servers often use


concurrency mechanisms such as multi-threading or asynchronous I/O.

Sockets are crucial for network communication, enabling applications to interact with
each other and coordinate tasks effectively across different systems.
3.A) Discuss the issues relating to datagram communication.
Datagram communication in distributed systems, while offering simplicity and
efficiency, introduces several issues that can impact reliability and consistency.
Datagram communication uses packets, or datagrams, to send data across a network
without establishing a connection.

Message Loss: In datagram communication, message loss is a significant concern.


Since datagrams are sent independently without establishing a connection, there is no
guarantee that they will reach their destination. Network issues such as congestion,
packet collisions, or hardware failures can cause datagrams to be dropped. This loss
can lead to incomplete data transfer and disrupt the functioning of applications that
rely on the timely and accurate receipt of all messages.

Message Duplication: Datagram communication can also result in message


duplication. This occurs when identical datagrams are received multiple times, often
due to retransmissions or network retries. Duplication can confuse the receiving
application, as it may process the same data multiple times, potentially leading to
inconsistent or erroneous results. Handling duplicates requires additional logic to
detect and discard redundant messages.

Out-of-Order Delivery: Another challenge with datagram communication is out-of-


order delivery. Since datagrams are sent independently, they may arrive at the
destination in a different order than they were sent. This can disrupt the sequence of
operations or data that the application expects. Applications relying on datagrams
must implement mechanisms to reorder messages correctly or handle them in a way
that accommodates out-of-sequence arrival.

Lack of Reliability: Datagram communication lacks built-in reliability mechanisms,


which is a fundamental issue. Unlike connection-oriented protocols that ensure data
is delivered reliably through acknowledgments and retransmissions, datagram
communication does not provide such assurances. This means that if a datagram is
lost, corrupted, or delayed, there is no automatic recovery process, requiring additional
application-level protocols to handle reliability.

Error Handling: Error handling is more complex in datagram communication because


datagrams are sent without a connection or error-checking mechanisms. If errors occur
during transmission, such as data corruption or loss, there is no inherent way to detect
or correct these issues. Applications using datagram communication must implement
their own error-detection and correction strategies to ensure data integrity and
reliability.
Security: Security is a major concern in datagram communication due to its lack of
built-in encryption and authentication. Datagrams are transmitted openly over the
network, making them vulnerable to interception and tampering. To address security
risks, additional measures such as encryption, authentication, and integrity checks
must be implemented to protect the data being transmitted and ensure it remains
confidential and unaltered.

3.B) Explain the different methods for inter-process communication.

Inter-process communication (IPC) is set of interfaces, which is usually programmed


in order for the programs to communicate between series of processes. This allows
running programs concurrently in an Operating System. These are the methods in IPC:

Methods in Interprocess Communication

1. Pipes (Same Process) – This allows flow of data in one direction only.
Analogous to simplex systems (Keyboard). Data from the output is usually
buffered until input process receives it which must have a common origin.

2. Names Pipes (Different Processes) – This is a pipe with a specific name it can
be used in processes that don’t have a shared common process origin. E.g. is
FIFO where the details written to a pipe is first named.

3. Message Queuing – This allows messages to be passed between processes


using either a single queue or several message queue. This is managed by
system kernel these messages are coordinated using an API.
4. Semaphores – This is used in solving problems associated with synchronization
and to avoid race condition. These are integer values which are greater than or
equal to 0.

5. Shared memory – This allows the interchange of data through a defined area
of memory. Semaphore values have to be obtained before data can get access
to shared memory.

6. Sockets – This method is mostly used to communicate over a network between


a client and a server. It allows for a standard connection which is computer and
OS independent.

Inter process communication (IPC) refers to the mechanisms and techniques used by
operating systems to allow different processes to communicate with each other. There
are several methods of IPC, each with its own advantages and disadvantages.

4.A) Explain Multicast transmission in Distributed Systems? Discuss about


important applications of Multicast Transmission in Distributed systems.

Multicast Transmission in Distributed Systems

Multicast transmission is a method of communication in distributed systems where


a single message is sent from a sender to multiple recipients simultaneously. Unlike
unicast (one-to-one communication) and broadcast (one-to-all communication),
multicast targets a specific group of recipients, allowing for efficient distribution of
data to multiple receivers without unnecessary duplication of messages.

How Multicast Transmission Works

1. Group Addressing: Multicast uses special group addresses to identify the


group of recipients. Devices or processes interested in receiving the multicast
messages join a multicast group, subscribing to messages sent to that group
address.

2. Efficient Distribution: Instead of sending multiple copies of a message to each


recipient, multicast sends a single copy to the group address. Network
infrastructure (e.g., routers) ensures that the message is efficiently distributed
to all members of the group.

3. Protocol Support: Multicast is supported by various protocols, including


Internet Protocol (IP) multicast, which uses specific IP address ranges reserved
for multicast traffic. In IP multicast, protocols like IGMP (Internet Group
Management Protocol) manage group membership, while protocols like PIM
(Protocol Independent Multicast) handle routing and delivery.

Important Applications of Multicast Transmission

1. Video Conferencing: Multicast is extensively used in video conferencing


applications where multiple participants need to receive real-time video and
audio streams simultaneously. By using multicast, the video stream is sent only
once to the multicast group address, reducing network congestion and
bandwidth usage compared to unicast.

2. Live Streaming: Live streaming services, such as broadcasting live events or


streaming live television, benefit from multicast transmission. Multicast allows
efficient distribution of live content to multiple viewers, minimizing the load on
the streaming server and the network.

3. Online Gaming: In multiplayer online games, multicast transmission can be


used to distribute game state updates and events to all players simultaneously.
This ensures that all players receive consistent updates and reduces the server
load compared to sending individual updates to each player.
4. Software Updates and Distribution: Multicast is useful for distributing
software updates or patches to a large number of clients within a network. By
sending the update once to a multicast group, the update is efficiently
disseminated to all subscribed clients, saving bandwidth and reducing update
time.

5. Financial Data Dissemination: In financial markets, multicast is used to


broadcast real-time market data, such as stock prices and trade information, to
multiple trading systems and clients. This ensures that all subscribers receive
timely and consistent data with minimal latency.

6. Collaborative Work Environments: For collaborative applications, such as


shared whiteboards or document editing tools, multicast enables real-time
updates and synchronization across multiple users. Changes made by one user
can be quickly disseminated to all other participants, enhancing collaboration.

7. Network Management: Multicast can be used for network management tasks,


such as distributing configuration updates or monitoring data to multiple
network devices. This allows for efficient communication and coordination of
network management operations.

Multicast transmission enhances efficiency and scalability in distributed systems by


reducing redundancy and optimizing resource utilization. Its applications span various
domains, demonstrating its importance in modern communication and data
distribution scenarios.
5.A) Compare group communication with client/server communication

comparison between group communication and client/server communication in table


format:

Aspect Group Communication Client/Server Communication

Communication One-to-many (single message One-to-one (request-response


Model to multiple recipients) between a single client and server)

Broadcasting updates,
distributing notifications, real- Querying databases, accessing web
Use Case time data sharing services, retrieving files

Scales well with increasing Can face challenges with many


number of recipients; sender clients; each request is handled
Scalability sends one message to a group individually by the server

Managing group membership, Server resource management,


Challenges efficient delivery to all members handling high request loads

Requires mechanisms for Typically relies on TCP/IP for


reliable delivery, handling accurate delivery and may use
message loss, duplication, and redundancy and failover for server
Reliability order reliability

Reliable multicast protocols, TCP/IP for reliable communication,


Protocols Group Management Protocols HTTP/HTTPS for web services

Efficient in terms of bandwidth Can be resource-intensive as each


Resource as a single message is sent to client request requires server
Utilization multiple recipients processing
Aspect Group Communication Client/Server Communication

Simpler request-response model


Complex group management but may require sophisticated
Complexity and synchronization server-side logic

6.B) What is Inter process communication? How does TCP


communication differ from UDP communication?
nter-Process Communication (IPC)

Inter-Process Communication (IPC) is a mechanism that allows processes to


communicate and coordinate their actions when running concurrently. IPC enables
processes to share data, send messages, and synchronize their activities. It is crucial in
distributed systems, multi-threaded applications, and any environment where multiple
processes need to work together. IPC methods include pipes, message queues, shared
memory, semaphores, and sockets.

TCP vs. UDP Communication

comparison between TCP (Transmission Control Protocol) and UDP (User Datagram
Protocol)

TCP (Transmission Control


Aspect Protocol) UDP (User Datagram Protocol)

Connection-oriented;
establishes a connection before Connectionless; no connection
Connection data transfer establishment before data transfer

Reliable; ensures that data is Unreliable; does not guarantee data


Reliability delivered accurately and in order delivery or order

Ensures data integrity through


Data error checking and No built-in error checking or
Integrity retransmissions retransmission mechanisms
TCP (Transmission Control
Aspect Protocol) UDP (User Datagram Protocol)

Uses flow control to prevent No flow control; sender can send data
Flow Control overwhelming the receiver at any rate

Error Provides error detection and Minimal error detection; no error


Handling correction (e.g., checksum) correction

Guarantees that data packets are


delivered in the order they were
Ordering sent No guarantee of packet ordering

Slower due to connection


establishment, error checking, Faster due to lack of connection setup
Speed and retransmissions and error recovery

Higher overhead due to


connection management and Lower overhead as it lacks connection
Overhead reliability features management and reliability features

Suitable for applications where Suitable for applications where speed


reliability and data integrity are is important and occasional data loss is
crucial (e.g., web browsing, acceptable (e.g., live streaming, online
Use Cases email) gaming)

Stream vs. Stream-based; data is read as a Datagram-based; data is sent as


Datagram continuous flow discrete packets

You might also like