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

Revise chapter 3 #54

Merged
merged 3 commits into from Jul 11, 2023
Merged

Revise chapter 3 #54

merged 3 commits into from Jul 11, 2023

Conversation

hycinth22
Copy link
Contributor

No description provided.

@@ -138,10 +138,10 @@ fn f() {
}
```

由于 join 和产生操作形成 happens-before 关系,我们肯定知道 X 的加载操作在第一个 store 之后,但在随后一个 store 之前,正如在图 3-2 所见。然而,它是否在第二个存储之前或之后观察值是不可预测的。换句话说,它可能是 1 或 2,但不是 0 或 3。
由于 join 和 spawn 操作形成 happens-before 关系,我们肯定知道 X 的 load 操作在第一个 store 之后,但在最后一个 store 之前,正如在图 3-2 所见。然而,它是否在第二个 store 操作之前或之后观察值是不可预测的。换句话说,它可能是 1 或 2,但不是 0 或 3。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hycinth22 这里需要一个讨论,关于 storeload 这两个原子操作该不该译。

因为 store 和 load 操作和方法它们共用名称,所以就没有像 compare-and-exchange 操作和 compare_exchange 方法那样区分,全部将 compare-and-exchange -> 「比较并交换」,或者将 fetch-and-motify -> 「获取并修改」。

如果粗略一点,可以不译 store、load。或者你对这两个原子操作有什么建议?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的意见的话,如果是明确指代代码中的特定操作,我比较倾向于作为众所周知的专有名词不译(就像没有人会翻译DNA这种词)。
这是基于这样的理由:首先代码肯定还是英文的、含有load/store等词,并且本书的读者也是需要理解这些代码的,所以我觉得我们可以合理认为,本书读者(或者至少读过此书介绍后)头脑中应当是有这些词的概念的。
所以,这种词翻译的意义可能并不大,并且即使我们翻译了,读者阅读时也还是需要想想英文是什么才能在示例代码中找到对应操作。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍,将仅在「操作」之前的部分专有名词不译

@fwqaaq fwqaaq mentioned this pull request Jul 10, 2023
10 tasks
3_Memory_Ordering.md Outdated Show resolved Hide resolved
@@ -138,10 +138,10 @@ fn f() {
}
```

由于 join 和产生操作形成 happens-before 关系,我们肯定知道 X 的加载操作在第一个 store 之后,但在随后一个 store 之前,正如在图 3-2 所见。然而,它是否在第二个存储之前或之后观察值是不可预测的。换句话说,它可能是 1 或 2,但不是 0 或 3。
由于 join 和 spawn 操作形成 happens-before 关系,我们肯定知道 X 的 load 操作在第一个 store 之后,但在最后一个 store 之前,正如在图 3-2 所见。然而,它是否在第二个 store 操作之前或之后观察值是不可预测的。换句话说,它可能是 1 或 2,但不是 0 或 3。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍,将仅在「操作」之前的部分专有名词不译

@fwqaaq fwqaaq merged commit 3b6f5c5 into rustcc:main Jul 11, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants