Szymański's algorithm: Difference between revisions
m
remove dup typo
m (remove dup typo) |
|||
Line 1:
{{draft task}}
<em>Szymański's algorithm</em>
The algorithm allows mutiple processes or tasks to access a serial resource without conflict, using only linear waiting times.
Line 24:
"""
using ThreadSafeDicts # implement a single lock on all
const dict = ThreadSafeDict()
Line 39:
yield()
end
dict[id] = 3
if any(t -> flag(t) == 1, others) # Another process is waiting to enter
dict[id] = 2 # Waiting for other processes to enter
|