Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Disruptor中填充了多少字节的补充 #2259

Open
kikihhe opened this issue Feb 15, 2024 · 2 comments
Open

关于Disruptor中填充了多少字节的补充 #2259

kikihhe opened this issue Feb 15, 2024 · 2 comments
Labels
perfect content improve the content

Comments

@kikihhe
Copy link
Contributor

kikihhe commented Feb 15, 2024

如下为 Java Guide网站上所述:
image
在源码中,一共有两个地方添加了无效数据填充来解决伪共享问题,一个是消费者和生产者的进度序号 Sequence,一个是 放置数据的环形数组 RingBuffer,如下:

  1. Sequence 中填充的无效字节:
    image
  2. RingBuffer 中填充的无效字节主要包含在数组中,数组存储的数据并不是全部都是有效数据,而是 无效填充+有效数据 的组合,如下所示:
    image
@Snailclimb
Copy link
Owner

如下为 Java Guide网站上所述: image 在源码中,一共有两个地方添加了无效数据填充来解决伪共享问题,一个是消费者和生产者的进度序号 Sequence,一个是 放置数据的环形数组 RingBuffer,如下:

  1. Sequence 中填充的无效字节:
    image
  2. RingBuffer 中填充的无效字节主要包含在数组中,数组存储的数据并不是全部都是有效数据,而是 无效填充+有效数据 的组合,如下所示:
    image

感谢补充,学到了,欢迎提交一个PR完善一下这部分内容,感谢!

@Snailclimb
Copy link
Owner

Snailclimb commented Feb 17, 2024

PR:#2262

@Snailclimb Snailclimb added the perfect content improve the content label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perfect content improve the content
Projects
None yet
Development

No branches or pull requests

2 participants