Mastering Concurrency in Go
By Nathan Kozyra
Publisher: Packt Publishing
Final Release Date: July 2014
Pages: 328

In Detail

This book will take you through the history of concurrency, how Go utilizes it, how Go differs from other languages, and the features and structures of Go's concurrency core. Each step of the way, the book will present real, usable examples with detailed descriptions of the methodologies used. By the end, you will feel comfortable designing a safe, data-consistent, high-performance concurrent application in Go.

The focus of this book is on showing you how Go can be used to program high-performance, robust concurrent programs with Go's unique form of multithreading, which employs goroutines that communicate and synchronize across channels. Designed for any curious developer or systems administrator with an interest in fast, non-blocking, and resource-thrifty systems applications, this book is an invaluable resource to help you understand Go's powerful concurrency focus.


A practical approach covering everything you need to know to get up and running with Go, starting with the basics and imparting increasingly more detail as the examples and topics become more complicated. The book utilizes a casual, conversational style, rife with actual code and historical anecdotes for perspective, as well as usable and extensible example applications.

Who this book is for

This book is intended for systems developers and programmers with some experience in either Go and/or concurrent programming who wish to become fluent in building high-performance applications that scale by leveraging single-core, multicore, or distributed concurrency.

Product Details
Recommended for You
Customer Reviews


by PowerReviews
oreillyMastering Concurrency in Go

(based on 2 reviews)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 2 customers

Displaying reviews 1-2

Back to top

(5 of 8 customers found this review helpful)


Chaotic and full of errors

By Kaloian Doganov

from Sofia, Bulgaria

Verified Reviewer

Comments about oreilly Mastering Concurrency in Go:

Honestly, I don't see how this book can be called "Mastering Concurrency...". There is a racing condition in its first example, and it goes worse from there.

The author does not distinguish between the Go language from its implementation. While discussing goroutines, we are left with the impression that specifics of Go Compiler 1.3/1.4 implementation of goroutines are part of the language semantics. Hence, some examples in the first chapter will deadlock or produce errors when compiled and ran with gccgo, or even Go Compiler 1.5. Note that the Go language semantics hasn't changed with those compilers. The examples are just not correct concurrent programs. This is exactly the opposite of what one would expect from a concurrency book.

The concept of closing a channel is introduced with the sentence: "It's critical that all channels are closed at some point or our application will hit a deadlock." Which can be true in some cases, but it is nonsense as a general rule, and also does not apply in the authors' actual example.

And so on.

Overall, the text is chaotic and full of errors. Concepts are introduced randomly, and seldom well explained. I regret buying this book.

(4 of 4 customers found this review helpful)


Learning Concurrency in Go is Essential

By frellus

from Santa Clara, CA

About Me Developer

Verified Reviewer


  • Accurate
  • Easy to understand
  • Helpful examples
  • Well-written


    Best Uses

    • Expert
    • Intermediate

    Comments about oreilly Mastering Concurrency in Go:

    It's really hard to write a book about an evolving programming language, such as Go. Tools and libraries are constantly changing, and best practices are being developed as the community grows. As far as books to cover Go *beyond* a basic introduction, there are very few for sure, but this one you'll want to own.

    Nathan focused on one of Go's most powerful features - concurrency: go routines and channels. I found the book overall highly informative and well written. It took me a few passes of the book to fully extract all the points, and I think that others coming from languages which don't lend themselves well to parallelism - such as Python, Perl and others - will have a similar experience. Programming concurrently requires you to think about problems in a very different way, and this book does an excellent job of building up the concepts and methods which are going to be important to a successful developer.

    What does it cover, at a high level?
    - goroutines
    - channels (buffered, unbuffered)
    - cross-channel communication techniques and synchronization methods
    - comparison of Go synchronization to CSP (Communicating Sequential Processes) and actor models (ex. Erlang)
    - design patterns for concurrency
    - deadlocks and race conditions and how to avoid (and detect) them

    What I highly appreciated about the book in particular:
    - lots of visual examples to drive concepts of how concurrent go routines work
    - touches on a *lot* of useful third-party tools and libraries for the examples (Gorilla, Heka, Memcached, MongoDB, Redis, CouchDB, Cassandra, Couchbase, fsnotify and many, many others - even Google App Engine)
    - analyzation techniques and touches interesting tools/apps for Go (ex. pprof, GNUplot, Heka)

    What I'd like to see / improve about the book:
    - *all* the code examples to be able to re-produce any part of the work in the book (ex. I cannot find the GNUplot scripts anywhere..)
    - an acronym or definitions section for easy reference (ex. CSP, C10K, "actor", etc.)
    - the author should be more vocal in the community.. talks, blogs and/or online presence in general

    A basic summary of the book is as follows:
    Chapter 1 - An Introduction to Concurrency in Go
    + introduces goroutines and channels
    + compares how Go handles concurrency compared to other languages
    Chapter 2 - Understanding the Concurrency Model
    + talks about resource allocation, channels and 'channels of channels'
    + explains how Go manages concurrency internally with excellent visualization of concurrent routines working together
    Chapter 3 - Developing a Concurrent Strategy
    + discusses how to plan out solving application problems with concurrency
    + introduces some third-party tools
    Chapter 4 - Data Integrity in an Application
    + looks at issues with concurrency and data structures and how Go handles state
    + discusses how to synchronize data between different machines
    Chapter 5 - Locks, Blocks, and Better Channels
    + blocking methods, building on the concepts from the prior chapters
    + discusses how you can avoid dead locks with Go
    Chapter 6 - C10K - A Non-blocking Web Server in Go
    + concrete example of creating a web server with Go concurrency using everything learned in the prior chapters plus a database (MySQL)
    Chapter 7 - Performance and Scalability
    + focuses on optimizing your concurrent Go code
    + builds on the web server created from Chapter 6
    Chapter 8 - Concurrent Application Architecture
    + focuses on when and where to implement concurrent patterns
    + how to take advantage of advanced hardware and keeps data consistent
    Chapter 9 - Logging and Testing Concurrency in Go
    + OS-specific methods for developing, tested and deploying your app
    Chapter 10 - Advanced Concurrency and Best Practices
    + looks at complicated and advanced techniques for concurrency
    + discusses various testing and documentation methods

    Displaying reviews 1-2

    Back to top

    Buy 2 Get 1 Free Free Shipping Guarantee
    Buying Options
    Immediate Access - Go Digital what's this?
    Ebook:  $30.99
    Formats:  ePub, Mobi, PDF