Traditional Culture Encyclopedia - Travel guide - Go CSP concurrency model
Go CSP concurrency model
Go's CSP concurrency model
Go implements two forms of concurrency. The first one is generally recognized by everyone: multi-threads share memory. In fact, it is multi-threaded development in languages ????such as Java or C++. The other one is unique to Go language and recommended by Go language: CSP (communicating sequential processes) concurrency model.
CSP is the abbreviation of Communicating Sequential Process. It can be called Communicating Sequential Process in Chinese. It is a concurrent programming model proposed by Tony Hoare in 1977. Simply put, the CSP model consists of concurrently executing entities (threads or processes). Entities communicate by sending messages. The channel used when sending messages is a channel, or channel. The key to the CSP model is to focus on the channel, not the entity sending the message. Go language implements part of CSP theory.
"Don't communicate by sharing memory. On the contrary, share memory through communication."
Go's CSP concurrency model is through goroutine and Channel is implemented.
Goroutine is the concurrent execution unit in Go language. In fact, it is a coroutine.
Channel is the communication mechanism before each concurrent structure (goroutine) in the Go language. In layman's terms, it is the "pipeline" for communication between goroutines, which is somewhat similar to the pipes in Linux.
Channel
Goroutine
- Related articles
- How about Taizhou Carnival International Travel Service Co., Ltd.
- How about Feng Tong Zhaidengchigou Scenic Area?
- Tourism route map of western Zhejiang
- How to arrange reasonable tourist routes for Beihai tourism?
- How many springs are there in Wuquan Mountain in Lanzhou? What are they called?
- 20 1 1 Inner Mongolia College Entrance Examination Paper Collection and Answers
- Where is the best place to take children on a day trip to Zaozhuang?
- I study tourism management and want to transfer to financial insurance.
- How about Tianjin Shangshan Travel Co., Ltd.
- How to apply for a tourist visa in Japan