Jump to content

Talk:Atomic updates: Difference between revisions

Transfer is clarified
No edit summary
(Transfer is clarified)
Line 13:
}</lang>
:::::Assume that this entire routine is executed atomically. It preserves both invariants -- the sum of buckets (by changing two buckets by equal and opposite amounts) and that each bucket is positive (by clamping the amount transferred). Why can't you do the same thing in Ada? --[[User:Kevin Reid|Kevin Reid]] 18:48, 18 May 2009 (UTC)
::::::Ah, finally I've got it. Thanks for an explanation. That is no problem. Can you move this definition of transfer into the task description? E.g. "takes two indices and then adds a specified amount to the bucket indexed by one and subtracts it from one indexed by another index, but no more than its total value." One question remains, how can this transfer be used to make pairs of buckets equal (averaging)? You need an atomic read + decide + update operation. Or this is not required by the task? --[[User:Dmitry-kazakov|Dmitry-kazakov]] 19:24, 18 May 2009 (UTC)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.