|
|
Log in / Subscribe / Register

Concurrent code and expensive instructions

Concurrent code and expensive instructions

Posted Feb 12, 2014 11:16 UTC (Wed) by ego360 (subscriber, #39650)
Parent article: Concurrent code and expensive instructions

Nice article Paul.
In the answer to Quick quiz 2, you say:

However, the linearizability of this function depends on the counter always being incremented by the value 1

If the counter is always incremented by some constant value k, that would also guarantee linearizability, no ?

It is interesting that you mention the split counter approach to implement a counter that doesn't lose counts and yet doesn't use any heavyweight instructions. The G-Counters implemented in RIAK as a part of their Conflict Free Replicated Datatypes (CRDT) suite use a similar approach. It is another story that these data structures have been implemented for the distributed systems world. But then considering that on modern multiprocessor systems, the data is cached at so many levels, should we not model these systems as distributed systems since different processing units might not have the same view of the state of the system? We could then use alternate weaker notions of consistency such as eventual consistency to argue about the correctness about our implementations instead of ignoring concurrent algorithms that are not linearizable.


to post comments

Concurrent code and expensive instructions

Posted Oct 2, 2014 6:00 UTC (Thu) by PaulMcKenney (✭ supporter ✭, #9624) [Link]

You are quite right, incrementing by any constant (and especially the constant zero!) guarantees linearizability.

And I agree that it can make a lot of sense to apply distributed-system algorithms to shared-memory systems, especially to the fastpath portions of shared-memory systems.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds