Reaves.dev

v0.1.0

built using

Phoenix v1.7.12

State In Distributed Systems

Stephen M. Reaves

::

2023-02-01

Notes about Lesson 4 of CS-7210

Required Readings

Summary

Terminology

Distributed System := a collection of nodes and the communication channels between them

Nodes communicate by sending messages and the sending/receiving of a message constitutes and Event.

Process state := most recent event at that node

Channel state := in flight messages

System/Global state := collection of state from all of the nodes/processes and channels

Every event changes the state of at least one entity, which corresponds to a change of state in the entire system.

State := point in time of execution

Run := a subsequence of events

A run may be actual or observed

Actual Run := exactly what happened

Observed Run := what could have potentially happened

Cut := vertical slice of state at a given time

Prerecording Event := an event that happens before a cut

Postrecording Event := an event that happens after a cut

Consistent Cut := a cut where for all prerecording events ei e_i , if ei1ei e_{i-1} \rightarrow e_i , then ei1 e_{i-1} must also be prerecording.

Challenges

Instaneous recordings are not possible

System model

Processes are vertices

Channels are directed, FIFO, error-free edges

Finding a Consistent Cut

Chandy & Lamport Algorithm

Initiator node := the node that starts the algorithm snapshot

Initiator node:

All other processes:

Assumptions

Global State

Chandy & Lamport Algorithm Features

Recorded global state does not necessarily correspond to any real global state, only possible global state.

Permutations of possible global state are ok, as long as they don’t break causal relationships.

Properties of a Global State

stateDiagram-v2
    Initial --> S
    Initial --> S1
    Initial --> S*
    S --> Final
    S1 --> Final
    S* --> Final

If the state recorded (S*), and S* is reachable from Initial and Final is reachable from S*, then S* is a possible global state

Benefits of a Global State

Allows us to determine stable properties.

Stable Property := a property that once it becomes true for a state S, it remains true for all reachable states S'.

Unstable Property := a property that makes no gaurantee about truthiness across states

Examples of Stable Properties

Examples of Unstable Properties