Analyze the cache for linearizability violations. For each public method below,
identify its LINEARIZATION POINT — the single atomic step at which the operation
appears to take effect.
Methods to analyze:
Single-key operations:
- get(key), getIfPresent(key)
- put(key, value), putIfAbsent(key, value)
- remove(key), remove(key, value)
- replace(key, value), replace(key, oldValue, newValue)
- computeIfAbsent(key, function), compute(key, function), merge(key, value, function)
Bulk / aggregate operations:
- getAll(keys) / getAllPresent(keys)
- putAll(map)
- invalidateAll(keys) / invalidateAll()
- size(), containsKey(key), containsValue(value)
Note: Bulk operations are typically NOT linearizable as a unit. State whether each
provides any atomicity beyond per-element linearizability.
For each method:
- State the linearization point (e.g., "CAS on CHM bin at line X").
- If conditional, enumerate all cases.
- Construct a 2-thread scenario confirming the linearization point.
Then attempt to construct violations:
4. Can two threads observe operations in an inconsistent order?
- put(k, v1) / put(k, v2) / get(k): Can C see v2 then v1?
- computeIfAbsent(k, f): Can f execute twice concurrently?
- remove(k) / get(k): Can get return a value after remove linearized?
- Is size() linearizable or documented as an estimate? Bounds on error?
- For async cache variants: is the linearization point the future insertion
or completion? Can get() return an already-replaced future?
For each candidate violation:
- Provide the full interleaving
- Show the sequential history it violates
- Verify the interleaving is JMM-legal
Do not analyze internal consistency, only external observability.
1---2name: audit-linearizability3description: Analyze the cache for linearizability violations across all public methods4---56Analyze the cache for linearizability violations. For each public method below,7identify its LINEARIZATION POINT — the single atomic step at which the operation8appears to take effect.910Methods to analyze:1112Single-key operations:13- get(key), getIfPresent(key)14- put(key, value), putIfAbsent(key, value)15- remove(key), remove(key, value)16- replace(key, value), replace(key, oldValue, newValue)17- computeIfAbsent(key, function), compute(key, function), merge(key, value, function)1819Bulk / aggregate operations:20- getAll(keys) / getAllPresent(keys)21- putAll(map)22- invalidateAll(keys) / invalidateAll()23- size(), containsKey(key), containsValue(value)2425Note: Bulk operations are typically NOT linearizable as a unit. State whether each26provides any atomicity beyond per-element linearizability.2728For each method:291. State the linearization point (e.g., "CAS on CHM bin at line X").302. If conditional, enumerate all cases.313. Construct a 2-thread scenario confirming the linearization point.3233Then attempt to construct violations:344. Can two threads observe operations in an inconsistent order?35 - put(k, v1) / put(k, v2) / get(k): Can C see v2 then v1?36 - computeIfAbsent(k, f): Can f execute twice concurrently?37 - remove(k) / get(k): Can get return a value after remove linearized?385. Is size() linearizable or documented as an estimate? Bounds on error?396. For async cache variants: is the linearization point the future insertion40 or completion? Can get() return an already-replaced future?4142For each candidate violation:43- Provide the full interleaving44- Show the sequential history it violates45- Verify the interleaving is JMM-legal4647Do not analyze internal consistency, only external observability.