1

Topic: volatile-only lock

To write synchronization between flows, using only volatile variables (at which  only a read and write, but not modification)

2

Re: volatile-only lock

Hello, nikholas, you wrote: N> to Write to Whom to write and for what? N> synchronization between flows, using only volatile variables (at which  only a read and write, but not modification) volatile does not give any warranties of elementary quality. Especially without platform/compiler instructions. So question setting is incorrect.

3

Re: volatile-only lock

Hello, Kodt, you wrote: Hello, nikholas, you wrote: N>> to Write synchronization between flows, using only volatile variables (at which  only a read and write, but not modification) Even more simple decision: global . Let at us N worker threads. We get N Boolean variables and one (N+1)-richnuju - number of the current owner. Also we launch a flow-assistant which threshes an inquiry cycle. - If number of the current owner is exposed - simply waits, when that will be dropped - waits, any flag of request will not be cocked yet - drops this flag and exposes number the Worker thread - exposes the flag - waits, the number will not be exposed yet - makes operation - drops number With a flow-assistant is more simple  two variables, a worker thread writes in  the number and waits it in the second change, the assistant waits in the first variable nonzero  and writes this value to the second. It is much more interesting to invent the decision without a flow-assistant, at least for 2 flows

4

Re: volatile-only lock

Hello, nikholas, you wrote: N> to Write synchronization between flows, using only volatile variables (at which  only a read and write, but not modification) https://en.wikipedia.org/wiki/Peterson%27s_algorithm - for 2 flows https://en.wikipedia.org/wiki/Lamport%2 … _algorithm - for n flows