JuliaParallel / JuliaParallel/Dagger.jl

Adding tracing mode with vector clocks

Open
#196 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
723
Forks
90
Avg merge
1d 37m
Merged PRs (30d)
9

Description

A minimal implementation of vector clocks in Julia:

```
# do we need a lock here?
struct VClock
stamps::Dict{Symbol, Int64}
VClock() = new(Dict{Symbol, Int64}())
end

function tick!(vc::VClock, host)
vc.stamps[host] = get(vc.stamps, host, 0) + 1
end

function set!(vc::VClock, host, tick)
vc.stamps[host] = tick
end

function findTicks(vc::VClock, host)
if !haskey(vc.stamps, host)
return nothing
end
return vc.stamps[host]
end

lastUpdate(vc::VClock) = maximum(values(vc.stamps))
Base.merge!(vc::VClock, other::VClock) = merge!(max, vc.stamps, other.stamps)
function Base.print(io::IO, vc::VClock)
print(io, '{')
first = true
for (key, value) in vc.stamps
first || print(io, ',')
first = false
print(io, '"')
print(io, key)
print(io, '"')
print(io, ':')
print(io, value)
end
print(io, '}')
end
```

Vector clocks are a good way to do a happen-before analysis. https://bestchai.bitbucket.io/tsviz/index.html
To keep the overhead low we should make this optional, but each message should `tick` the vector clock.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.