Cover page by David Chisnall

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

10. Concurrency Design Patterns

In Chapter 9, Goroutines, we looked at a number of ways of synchronizing activities between goroutines, using patterns that are common in other languages. As with other facets of the language, there are some idioms that are natural in Go, but which would not make sense in another language.

Concurrency is a core part of Go. Spawning a new goroutine, which is roughly analogous to a thread, requires you to type three characters, including the space. The implementation of these goroutines in gc is similarly lightweight—slightly more than a function call but not much. In gccgo, it is equivalent to an operating system thread.

In the last chapter, we saw that Go has more or less the same set of synchronization primitives ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required