Using Mutexes in Go

I recently wrote an overview on concurrency, but I didn’t add a working example of mutexes. My goal in this post is to show how mutexes can be helpful when dealing with shared state and concurrent threads.


Concurrency refers to multiple computations happening at the same time. It is a form of parallel computation. Many programs we use today have some sort of concurrent process, even our operating system.