Distributed Systems Playground

    Language quick reference

    A program contains interfaces and algorithms. An algorithm implements one interface and uses others: Net (network) and Rounds (synchronous rounds) are provided by the simulator; the rest you write yourself, and they are wired together automatically.

    upon event ⟨instance, Event | pattern⟩ where condition do … end
    upon condition expression do … end
    upon exists x in S where condition do … end
    trigger ⟨instance, Event | arg1, arg2⟩
    forall q in neighbors where q ≠ p do … end
    if … then … elif … then … else … end
    starttimer(t, 100ms)   canceltimer(t)
    ⟨timer, Timeout | t⟩   assert cond, "msg"   log x
    function name(a, b) … return value … end      call name(x, y)
    uses PerfectLinks as pl via AckLinks

    Functions live inside an algorithm, see its state and parameters, and may trigger events; use them in expressions, or with call as a statement. via picks which algorithm implements a used interface when there are several.

    Indications go up, requests go down. Undeclared all-caps words (HEARTBEAT) are atoms. In patterns, a new name captures the value; an atom or a known name must match.

    Built-ins: self, Π, N, neighbors, round, now(), DELTA PHI RHO (only when known in the assumed model), min max choose size keys values map() get(m,k,default) remove(c,x) random(a,b) pick(S) append head tail last sort reverse slice range sum mean argmin argmax toset str abs sqrt ln exp pow floor ceil round. Tuples are 0-indexed; #S is the cardinality. Durations (50ms) are numbers in microseconds.

    ASCII equivalents: < > for ⟨ ⟩, union inter minus in notin subseteq, != <= >=, and or not, Procs for Π, {} for ∅. Inside an ASCII trigger, wrap comparisons in parentheses.

    t = 0
    delivered violation lost or discarded processing output crashed recovery network cut
    Events

      Export the scenario

      The JSON file holds topology, code, timing model, inputs, faults and seed: opening it again reproduces the same run.

      Images of the current view

      Import a scenario

      Distributed Systems Playground

      A playground for distributed algorithms: write them in the pseudocode of the textbooks, run them against a network that does not keep its promises, and check the properties they should satisfy.

      Author

      Francesco Del Re

      MIT licensed. Contributions, corrections and new algorithms are welcome.

      Settings

      The language setting translates the interface. Code, diagnostics from the checker and the documentation stay in English.

      Documentation

      Keyboard shortcuts

      Ctrl / Cmd + EnterRun
      SpacePlay or pause
      ← → or Page Up Page DownPrevious or next event
      Home EndStart or end of the run
      V N L DSelect, Node, Link, Delete tools
      DeleteDelete the selected process or link
      EscClear the selection, or leave presentation mode
      PPresentation mode
      FFull screen
      ?This list
      Ctrl + wheelZoom the diagram

      Shortcuts work everywhere except while typing in a text field.

      Examples