THN Interview Prep

Go — scheduler, goroutines & channels

Core details

Goroutine = lightweight user-space task; scheduler multiplexes many goroutines onto fewer OS threads (M:N).

Channels coordinate communication (“don’t communicate by sharing memory”) with blocking send/receive; select multiplexes.

GOMAXPROCS: parallel CPU-bound work across cores; default ≈ logical CPUs.

GC: concurrent, low-pause oriented—still tune allocations for hot paths.

Understanding

Goroutines are cheap vs OS threads—still not infinite: leaks from blocked goroutines on full channels or never-closed resources.

Errors: explicit error returns; panic for programmer faults—recover rarely in library boundaries.

Senior understanding

Context cancellation propagates deadlines through call trees. interfaces implicit—small interface consumers prefer.

Diagram

Loading diagram…

See also

Last updated on

Spotted something unclear or wrong on this page?

On this page