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

Re: Safe, regular or atomic registers



I think a trace of a safe register could look like this (1 writer, 1 reader, non-overlapping processes).

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 = End
Reader = None
Register = 2
Result =  3

== State 4 ==

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

== State 5 ==

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

== Final State ==

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