小编sil*_*nce的帖子

为什么类 jsr166e.Striped64.Cell 中的值字段需要额外填充?

在作为 JSR166 的一部分引入的类中,作者使用所谓的填充来填充 Striped64.Cell 类的单值字段。

以下是该课程的摘录:

/**
 * Padded variant of AtomicLong supporting only raw accesses plus CAS. The value field is placed
 * between pads, hoping that the JVM doesn't reorder them.
 * <p/>
 * JVM intrinsics note: It would be possible to use a release-only form of CAS here, if it were
 * provided.
 */
static final class Cell {
  volatile long p0, p1, p2, p3, p4, p5, p6;
  volatile long value;
  volatile long q0, q1, q2, q3, …
Run Code Online (Sandbox Code Playgroud)

java concurrency jvm

6
推荐指数
2
解决办法
393
查看次数

标签 统计

concurrency ×1

java ×1

jvm ×1