Open mtchuyen opened 4 years ago
https://levelup.gitconnected.com/how-to-implement-concurrency-and-parallelism-in-go-83c9c453dd2
https://medium.com/swlh/using-goroutines-and-wait-groups-for-concurrency-in-golang-78ca7a069d28
https://betterprogramming.pub/how-to-broadcast-messages-in-go-using-channels-b68f42bdf32e
Channels are a key component of concurrent programming in Golang. They offer a clean way to communicate between various Go routines.
However, in Go the same data can only be read once from a channel.
Therefore, to be able to send the same information to multiple listeners, we have two main options:
https://blog.devgenius.io/5-useful-concurrency-patterns-in-golang-8dc90ad1ea61
When a program or an algorithm is concurrent, it means that it is designed to be decomposed into smaller parts that will be executed in independent processes in parallel.
In other words, as Rob Pike said:
“Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once.” Concurrency: nghĩa là xử lý nhiều việc cùng lúc Parallelism: nghĩa là làm nhiều việc cùng lúc
goroutines thường được sử dụng trong Golang. Khi sử dụng goroutines thường sẽ phân làm 2 loại patter: concurrent và Synchronization
concurrent thường xử dụng các kỹ thuật:
Synchronization thường sử dụng các kỹ thuật:
Concurrency Patterns
Synchronization patterns in Go
http://blog.mozo.jp/2014/06/synchronization-patterns-in-go.html
https://code-pilot.me/post/Synchronization%20patterns%20in%20Go
https://www.linkedin.com/pulse/concurrency-patterns-go-part-2-miah-md-shahjahan/
https://dev.to/jolyon129/practical-synchronization-with-go-2nck
https://medium0.com/@fatbeanli/goroutine-synchronization-patterns-fafe3a35d3e6
https://www.reddit.com/r/golang/comments/11vtbod/synchronization_patterns_in_go/
Ref:
Concurrent programming is one of the most interesting features Golang has to offer.
a long time to run or to complete
) vào 1 concurrent khác.Concurrent dựa trên 2 kỹ thuật của Go:
GO routines combined with channels provide an easy way of performing independent tasks and communicating between them.
Tác dụng của concurrency
Jacob Kim:
Concurrency patterns
Concurrency patterns: các vấn đề
problems
hay được giải quyết (solve
) bởi concurrent.n
Values from StreamRef:
Go: Concurrency Bugs in Go
https://medium.com/a-journey-with-go/go-concurrency-bugs-in-go-7d3677a1f2a2