[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safe, regular or atomic registers



And a trace of a safe register  (1 writer, 1 reader, overlapping processes) could look like this for instance.


We have 4 variables Writer Reader Register Result.


Writer and Reader can take the values: None Start End


Register can take the value: 0, 1, 2


And Result can take the value: 0, 1 , 2 , 3


== Initial state ==


Writer = None
Reader = None
Register = 0
Result = 3

== State 1 ==

Writer = Start
Reader = None
Register = 0
Result = 3


== State 2 ==


Writer = Start
Reader = None
Register = 2
Result = 3

== State 3 ==

Writer = Start
Reader = Start
Register = 2
Result = 3

== State 4 ==

Writer = Start
Reader = Start
Register = 2
Result = 0

== State 5 ==

Writer = Start
Reader = End
Register = 2
Result = 0

== Final State ==

Writer = End
Reader = End
Register = 2
Result = 0