Tag: coroutine
-
Post Views: 23 In programming learning, judging prime numbers is a classic algorithm problem. When the amount of data is small, the traditional serial loop is enough to cope; but when the amount of data is expanded to hundreds of thousands or more, how to improve the computing efficiency has become the key. Based on the Go language, this paper…
-
Post Views: 36 In the concurrent programming of the Go language, the channel (channel) is the bridge connecting the goroutine. Many beginners often encounter “deadlock” errors when using unbuffered channels, or are confused about the blocking mechanism of the channel. This article will use a specific case to compare two different channel usage scenarios, and deeply analyze the blocking principle…
-
Post Views: 50 In the official tutorial of Go language, Web Crawler practice is a very classic concurrent programming case. It requires us to modify a basic recursive crawler so that it can crawl the URL in parallel, while ensuring that the same URL is not repeated. This article will take you to analyze the original code problem step by…
-
Post Views: 66 In the previous Go concurrency review, I focused on the many drawbacks of ‘global variable lock synchronization’ through factorial cases, especially the core question of ‘there are still hidden dangers when adding locks and hibernation’ Question – Manually set the sleep time to accurately match the rhythm of the execution of the protocol. If the resource is…
-
Post Views: 95 In Go language concurrent programming, goroutine is the core of efficient concurrency, but the communication and synchronization between multiple goroutines is often a place for beginners to easily step on pits. This article will take ‘calculate the factorials of 1-200 and store them into Map’ as a case, and combine the problems encountered in the learning process,…
-
Post Views: 32 As the core feature of the Go language, Goroutine is the key to lightweight concurrency. It is lighter than traditional operating system threads and has lower creation cost. The default initial stack is only 2KB and supports dynamic expansion, which allows developers to easily achieve high concurrency programming. For beginners who are new to Go concurrency, understanding…