blog
POST
2026-05-09

Understanding Concurrency in Go

Understanding Concurrency in Go

8 min read · golang · concurrency · backend

Concurrency is one of the main reasons developers fall in love with Go.

At first, it feels almost magical.

You use the go keyword and suddenly multiple things are happening at once.

But eventually you realize:

concurrency is not magic. It is structure, coordination, and controlled communication.


What Even Is Concurrency?

Concurrency ≠ Parallelism.

Concurrency

Multiple tasks making progress independently.

Parallelism

Tasks running at the same time on multiple CPU cores.


Your First Goroutine

package main

import (
    "fmt"
    "time"
)

func main() {
    go func() {
        fmt.Println("hello from goroutine")
    }()

    time.Sleep(time.Second)
}

Channels

ch := make(chan string)

go func() {
    ch <- "hello"
}()

msg := <-ch
fmt.Println(msg)

Worker Pattern

func worker(id int, jobs <-chan int) {
    for job := range jobs {
        fmt.Printf("worker %d processing %d\n", id, job)
    }
}

Final Thought

Concurrency changes how you think.

From single flow → many cooperating workers.