disruptor解析学习

消除伪共享

Cache line 有64个字节大小,共8个long 大小,左右都填充了7个long,保证一个Sequence 只会缓存在一个缓存行里

public class Sequence extends RhsPadding {}

class LhsPadding
{
    protected long p1, p2, p3, p4, p5, p6, p7;
}

class Value extends LhsPadding
{
    protected volatile long value;
}

class RhsPadding extends Value
{
    protected long p9, p10, p11, p12, p13, p14, p15;
}

你可能感兴趣的:(disruptor解析学习)