Skip to content

Replace global clock with Lamport timestamps #10

Description

@lou1306
  1. In the header, replace int __LABS_t with an array unsigned int clock[MAXCOMPONENTS]. Change the now() function so that it takes the agent's id as an argument.
  2. Inside init(), increase clock[0] when initializing stigmergic variables. At the end, set all elements of clock to the value of clock[0].
  3. Change confirm and propagate with a tie-breaking rule.

Feasible tie-breaking rules

Agent with lowest id "wins"

✅ original solution from Lamport,
✅ also the one used in Buzz
❌ requires to keep track of the id with another array Lid[MAXCOMPONENTS][MAXKEYL]

Smaller or equal Lvalue wins

✅ No changes to the data structures
❌ Requires some theoretical justification (eg. will the stigmergy be stable?)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions