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

sync pool 相关描述错误 #96

Open
Transme opened this issue Sep 7, 2023 · 0 comments
Open

sync pool 相关描述错误 #96

Transme opened this issue Sep 7, 2023 · 0 comments

Comments

@Transme
Copy link

Transme commented Sep 7, 2023

实际描述

  • 文件路径:book/zh-cn/part1basic/ch05sync/pool.md
  • 原文段落:
我们来证明一下此处确实不会发生取到自身的情况,不妨设:pid = (pid+i+1)%size 则 pid+i+1 = a*size+pid。 即:a*size = i+1,其中 a 为整数。由于 i<size,于是 a*size = i+1 < size+1,则: (a-1)*size < 1 ==> size < 1 / (a-1),由于 size 为非负整数,这是不可能的。

预期描述

(a-1)*size < 1 ==> size < 1 / (a-1) 这段的描述有问题,当 a=1 时是没办法做除法的,源代码的做法并不能保证不取到自身,只能保证最后一个取到自己。

附图

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant