0% found this document useful (0 votes)
9 views6 pages

Distributed Systems Long Answers Q3 To Q7

The document discusses key concepts in distributed systems including logical clocks, vector clocks, and the Chandy-Lamport snapshot algorithm, which help in ordering events and recording consistent global states. It also contrasts static and dynamic scheduling methods for task assignment in distributed systems, highlighting their advantages and disadvantages. Additionally, it outlines various consistency models in distributed systems, characteristics of distributed file systems, and the workflow of the Andrew File System (AFS).

Uploaded by

Jitesh Kumawat
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 views6 pages

Distributed Systems Long Answers Q3 To Q7

The document discusses key concepts in distributed systems including logical clocks, vector clocks, and the Chandy-Lamport snapshot algorithm, which help in ordering events and recording consistent global states. It also contrasts static and dynamic scheduling methods for task assignment in distributed systems, highlighting their advantages and disadvantages. Additionally, it outlines various consistency models in distributed systems, characteristics of distributed file systems, and the workflow of the Andrew File System (AFS).

Uploaded by

Jitesh Kumawat
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/ 6

Q3.

Logical Clocks, Vector Clocks, and Chandy-Lamport Algorithm

1. Logical Clocks (Lamport Timestamps):

- Logical clocks provide a method to order events in a distributed system.

- The "happens-before" relation (->) is defined:

- If two events occur in the same process, order by program sequence.

- If A is the send of a message and B is the receive, then A -> B.

- Lamport Clock Rules:

1. Increment the clock before each event.

2. On message send, send clock value.

3. On receive, set C = max(C_local, C_msg) + 1.

2. Vector Clocks:

- Overcomes the limitation of Lamport clocks not detecting concurrency.

- Each process maintains a vector of timestamps, one for each process.

- Vector is updated:

- Before event: V[i]++

- On receive: V = max(V_local, V_msg); then V[i]++

- Allows detection of concurrent events (V1 != V2 and neither is less than the other).

3. Chandy-Lamport Snapshot Algorithm:

- Solves the problem of recording a consistent global state.

- Works in an asynchronous system.

- Uses marker messages to coordinate snapshots:

- Initiator records its local state, sends marker to neighbors.

- Upon receiving a marker for the first time:

- Record local state.


- Send marker to neighbors.

- Record incoming messages until marker is received on all channels.

Result: All process states and messages in-transit are captured consistently.

Q4. Scheduling in Distributed Systems (Static vs Dynamic)

1. Introduction to Scheduling:

- Distributed scheduling is about assigning tasks to multiple processors/nodes to optimize execution

time and resource usage.

2. Schematic Representation:

- Draw nodes (processors), local queues, and a load balancer.

- Arrows indicate task transfer and scheduling decisions.

3. Static Scheduling:

- Decisions made before execution.

- Based on estimated workloads and resource availability.

- Example: Matrix multiplication divided equally among processors.

- Advantages: Simplicity, No runtime overhead

- Disadvantages: Inefficient under load variations, No adaptability

4. Dynamic Scheduling:

- Decisions are made during execution based on system state.

- Processes/tasks can migrate between nodes.

- Types:

- Sender-initiated
- Receiver-initiated

- Symmetrical

- Example: Work stealing in multi-core systems.

- Advantages: Adapts to workload, Improved performance

- Disadvantages: Communication overhead, Complexity

5. Comparison Table:

Feature | Static | Dynamic

--------|--------|--------

Timing | Compile-time | Run-time

Overhead | Low | High

Flexibility | Low | High

Example | Round-robin | Load balancing

Q5. Taxonomy of Consistency Models in Distributed Systems

1. Introduction:

- Consistency models define the rules for visibility and ordering of updates in distributed shared

memory or databases.

2. Taxonomy of Consistency Models:

Model | Description

------|------------

Strict Consistency | Read returns most recent write

Linearizability | Real-time equivalent of sequential consistency

Sequential Consistency | All operations appear in same order

Causal Consistency | Causally related operations are seen in order


Eventual Consistency | Updates will propagate eventually

3. Memory Consistency Models (No Synchronization):

- Monotonic Read: A process sees a non-decreasing set of writes.

- Read Your Writes: After a write, the process always sees its effect.

- Writes Follow Reads: Writes follow previous reads in ordering.

- Session Consistency: Combines monotonic read and read-your-writes within a session.

4. Use Cases:

- Causal: Social networks

- Eventual: DNS, shopping carts

- Sequential: Databases

Q6. Characteristics of Distributed File Systems + AFS

1. Characteristics of Distributed File Systems (DFS):

- Transparency: Access, location, concurrency, replication.

- Reliability: Failure resilience and recovery.

- Scalability: Can handle large number of clients/files.

- Performance: Use of caching, replication.

- Security: Authentication, access control.

2. Andrew File System (AFS):

Architecture:

- Based on client-server model.

- Components:

- Vice: Server-side
- Venus: Client-side

- Volumes: Logical unit of file grouping

Implementation Features:

- Whole-file caching: Files are fetched and stored entirely on the client.

- Callback: Clients are notified when a cached file becomes stale.

- Location transparency via a consistent namespace.

3. Workflow:

- On open: Venus checks local cache, fetches if not available.

- On write: Local changes cached, committed on close.

- On update: Server notifies Venus to invalidate cache.

4. Benefits:

- High performance

- Reduced server load

- Scalable

Q7. Snapshot Algorithm in Distributed Systems

1. Local Variables Used:

- Local process state

- Channel states for each incoming link

- Marker received flags for each channel

2. Chandy-Lamport Snapshot Algorithm:

Steps:
1. Initiator process records its state and sends a marker on each outgoing channel.

2. On receiving a marker:

- If it's the first marker:

- Record state, propagate markers.

- Start recording messages on other channels.

- If marker already received:

- Stop recording for that channel.

3. Termination:

- Snapshot completes once all processes have recorded their states and all in-transit messages are

logged.

4. Example: Token-Passing Ring

Processes P1 -> P2 -> P3 (circular):

- P1 starts snapshot and sends marker.

- P2 receives marker, records state, starts recording from P3.

- If P2 receives token from P3 before marker, that token is recorded in P2's channel state.

Result: Snapshot captures all local states + in-transit token.

You might also like