Easy to Follow Engineering Tutorials
Golang Concurrency — Go Routines and Channels
A really simple introduction to Go Routines and Channels
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: