Easy to Follow Engineering Tutorials

Golang Concurrency — Go Routines and Channels

Ran (Reine)
4 min readAug 9, 2022

A really simple introduction to Go Routines and Channels

Neon lights with parallel lines
Photo by Drew Beamer on Unsplash

Okay so…first off I’d like to apologize to my followers for not posting in months :’) I’ve been uhh…busy 😬 I’ll try to make up for it with better and more concise content though :) Hope you guys have all been well!

In today’s article we’ll be looking at the simplest example I can think of to illustrate what Go Routines and Channels are all about.

Go Routines are basically (from educative.io):

a lightweight execution thread in the Go programming language and a function that executes concurrently with the rest of the program. Goroutines are incredibly cheap when compared to traditional threads as the overhead of creating a goroutine is very low.

Let’s come up with the simplest example to illustrate this.

When we run this on Go Playground, here’s what we’ll get:

--

--

Ran (Reine)
Ran (Reine)

Written by Ran (Reine)

I live for days when I can watch skies of blue, while enjoying the view. Most other days I’m a city rat who scuttles between Art and Coding. SG NTU CS Grad.