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

【翻译完成】20180326-sync.RWMutex--Solving-readers-writers-problems.md #822

Merged
merged 1 commit into from
Sep 7, 2018

Conversation

errpunk
Copy link
Collaborator

@errpunk errpunk commented Sep 1, 2018

#807 初步翻译完成,有两点请知悉:

  • 原文有两个配图,我觉得与文章关系不大,没有加上,您看看是否需要加上
  • 因为文章比较深入地分析了 sync.RWMutex 的源码实现,所以我翻译的标题为《深入理解 sync.RWMutex:解决读者-写者问题》这个标题是否太长或不妥,请您考虑一下。

Copy link
Member

@polaris1119 polaris1119 left a comment

Choose a reason for hiding this comment

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

文章挺不错,翻译很棒,特别是译注。可以译者很用心,认真理解了文章。直接 merge

W
```

当在临界区里面的 go routine 数量发生变化时,程序就会换行。这些输出可以体现 `RWMutex` ”要么允许多个读者访问,要么允许一个写者访问“的特性。
Copy link
Member

Choose a reason for hiding this comment

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

”要么允许多个读者访问,要么允许一个写者访问“ 双引号有点问题

- 读者不能饿死
- 所有线程都不能饿死

像 [sync.RWMutex](https://golang.org/pkg/sync/#RWMutex) 这种多读者-单写者互斥锁的实现,可以解决其中的一些读者-写者问题。我们现在来看看要怎么用 Go 解决这些问题,并了解这种解决方案能给到怎样的保证。
Copy link
Member

Choose a reason for hiding this comment

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

这种多读者 前面似乎多了个空格


### 锁的拷贝

`go tool vet` 可以检测到是否有锁被按值拷贝了,因为这种情况会导致死锁,具体的情况可以看之前的一篇文章:[Detect locks passed by value in Go](https://medium.com/golangspec/detect-locks-passed-by-value-in-go-efb4ac9a3f2b)
Copy link
Member

Choose a reason for hiding this comment

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

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

Successfully merging this pull request may close these issues.

2 participants