Mastering Concurrency ⚔️: A Dive into Go’s Goroutines and Channels

Sumeet Ninawe
4 min readSep 10, 2023

One of the most in-demand skills in the cloud-native community is the ability to write concurrent programs to leverage all the multi-core processor power today’s hardware has to offer. Golang was developed keeping concurrency in mind.

Digital transformation does not just mean moving to cloud platforms. In fact, digital transformation is indeed a continuous process undertaken by organisations to constantly optimize their IT spend. Well, not just organizations, solo-businesses, and startups alike — who does not want to save money?

In this post, we will understand the concepts related to Golang’s concurrency, the benefits in the context of cloud architecture, and also explore a few patterns to use concurrency in Golang.

Goroutines vs. Threads

Before we move ahead, it is important to understand the difference between threads and goroutines.

Threads are managed by OS, while Goroutines are managed by Go runtime environment. Threads are single units of execution within a process — multiple threads belong to a process — and all these threads share the same resources. While Goroutines are independently scheduled functions and do not share resources.

--

--

Sumeet Ninawe

I write (and sometimes rant) about building a solo business in SaaS. More: https://letsdote.ch