Ds Part B
Ds Part B
2. Asynchronous Execution
Definition:
In asynchronous execution, the caller sends a request and continues its
execution without waiting for a response. The communication is non-
blocking.
Characteristics:
Sender does not wait for the receiver.
Receiver can process the request at a later time.
More complex to design and handle responses or errors.
Example in Distributed Systems:
Message queues or event-driven systems (e.g., RabbitMQ, Kafka) where
messages are processed independently of the sender’s workflow.
Advantages:
Better resource utilization and performance.
More resilient to delays and partial failures.
Disadvantages:
Harder to implement and manage (requires callbacks, polling, or
notification mechanisms).
Debugging and error handling can be more complex.
Comparison Table
Feature Synchronous Asynchronous
Blocking Yes No
Slower (waits for
Speed Faster (non-blocking)
response)
Complexity Simple to implement More complex logic
Efficiency Less efficient More efficient
Failure Handling More vulnerable More resilient
Use Case RPC, HTTP Messaging systems, Event-
Examples request/response driven apps
QUES… difference between Physical Clock and
Logical Clock:
Physical Clock Logical Clock
Shows real-world time (like a wall
Shows the order of events in a system.
clock).
Measured in hours, minutes, and
Measured by counting events.
seconds.
Used in real-time systems and
Used in distributed systems.
computers.
Needs to be accurate and
Just keeps track of what happened first.
synchronized.
Example: Event A happens before Event
Example: 2:30 PM on your phone.
B.
In short:
Physical Clock = Real time
Logical Clock = Order of events
✅ 1. Crash Failures
💡 What It Is:
A node (computer/server) stops working or goes offline unexpectedly.
❌ Problem:
Other nodes don’t know whether it’s slow or truly dead.
They may get stuck waiting for a response.
🛠 Real Example:
In a banking app, if a server handling payment crashes during a
transaction, others can’t confirm whether to complete or cancel the
transaction.
3. Flow Control
Makes sure the sender does not send data too fast for the receiver.
Controls the speed of data transfer.
Helps avoid overloading the receiver.
📌 Example: Like talking slowly so the other person can write notes.
4. Error Control
Detects and fixes errors in data.
Adds a checksum to check for mistakes during transmission.
📌 Example: Like double-checking a message to ensure there are no spelling
mistakes.
6. Congestion Control
Prevents network overload when too much data is sent at once.
Slows down data transfer if the network is too busy.
📌 Example: Like waiting in a traffic jam – only a few cars (data packets) can
go at a time.
Key Points:
1. Purpose:
To resolve incompatibility between two classes or systems
To allow integration between components without modifying existing
code.
Often used when integrating legacy systems with new modules.
⚙️Structure:
1. Target Interface: The interface expected by the client.
2. Adaptee: The existing class or system with a different interface.
3. Adapter: Implements the target interface and translates requests to the
adaptee.
1. Class Adapter (Inheritance-based)
Inherits from both the Target interface and the Adaptee class.
Tightly coupled due to inheritance.
Works only in languages that support multiple inheritance (e.g., C++).
3. Two-way Adapter
Implements both Target and Adaptee interfaces.
Enables objects of either type to work with the other.
Useful when bi-directional communication is required.
❌ Limitations:
It can lead to more aborts, especially in high-conflict situations.
Transactions that are younger may frequently get aborted even for minor
conflicts with older ones.
🔹 Advantages
Lightweight and Fast: Ideal for real-time systems and scenarios with
frequent short messages.
Scalable: Supports large number of clients due to no connection overhead.
Simple: Minimal setup compared to TCP.
🔹 Disadvantages
Unreliable: No guarantee that messages will reach their destination.
No Congestion Control: May lead to packet loss during network
congestion.
Not Suitable for Sensitive Data: Not ideal where accuracy or order is
critical.
Advantages of DSM
✅ Simplified Programming
Developers work with a single memory abstraction, no need to manage
message passing.
✅ Portability
DSM programs can be ported easily between systems due to their
common interface.
✅ Locality of Data
DSM fetches blocks of data, improving performance by anticipating future
needs.
✅ On-Demand Data Movement
Data is moved only when needed, saving bandwidth and reducing latency.
✅ Large Virtual Memory Space
Total memory available is the sum of all nodes' memory, enabling
memory-intensive applications.
✅ Performance Boost
Speeds up data access and improves overall system efficiency.
Disadvantages of DSM
❌ Slow Accessibility
Data access is slower than local memory access, due to network latency.
❌ Consistency Challenges
Maintaining memory consistency across nodes is complex and error-
prone.
❌ Inefficient Messaging
DSM may use asynchronous message passing, which isn't always optimal.
✅ Advantages of Microkernel
1. Security & Reliability
Smaller kernel means less attack surface and fewer chances of system
crashes.
2. Modularity & Maintainability
Easy to update, debug, or replace services without affecting the whole OS.
3. Portability & Scalability
Can be easily adapted to different hardware or embedded systems.
⚠️Disadvantages of Microkernel
1. Slower Performance
More context switches and message passing between components reduce
speed.
2. Higher Complexity
Designing and managing IPC between services is more complex.
3. More Memory Usage
Running multiple services in user space uses more RAM.