/ Go Engineering / Phase 5 Phase 5 Days 21-25
Concurrency, Channels & Context Goroutines, synchronization, cancellation, ownership, and race-free design
Phase Goal Build concurrent programs whose lifetime, ownership, and failure behavior are explicit.
Day 21: Goroutines & Lifecycle Ownership
Concurrency versus parallelism
Starting goroutines and scheduler intuition
Goroutine lifetime, leaks, and ownership
WaitGroup and the add-before-go rule
Day 22: Channels & Communication Protocols
Unbuffered channel synchronization
Buffered channels and backpressure
Closing, ranging, direction types, and ownership Define Closing, ranging, direction types, and ownership in plain language and explain the problem it solves Trace what the Go compiler or runtime does when Closing, ranging, direction types, and ownership is used Write a tiny example, then apply it to a realistic backend task Diagnose the beginner failure mode for Closing, ranging, direction types, and ownership and fix it deliberately
Deadlocks, blocked sends, and protocol diagrams
Day 23: select, Timeouts & Cancellation
select readiness and nondeterministic choice
Timers, tickers, cleanup, and time.After trade-offs Define Timers, tickers, cleanup, and time.After trade-offs in plain language and explain the problem it solves Trace what the Go compiler or runtime does when Timers, tickers, cleanup, and time.After trade-offs is used Write a tiny example, then apply it to a realistic backend task Diagnose the beginner failure mode for Timers, tickers, cleanup, and time.After trade-offs and fix it deliberately
context cancellation, deadlines, values, and propagation Define context cancellation, deadlines, values, and propagation in plain language and explain the problem it solves Trace what the Go compiler or runtime does when context cancellation, deadlines, values, and propagation is used Write a tiny example, then apply it to a realistic backend task Diagnose the beginner failure mode for context cancellation, deadlines, values, and propagation and fix it deliberately
Cancellation-aware loops and partial results
Day 24: Mutexes, Atomics & Race-Free State
Data races versus logical races
sync.Mutex, RWMutex, and lock scope
Atomics for narrow counters, not general state
go test -race and reproducible race tests
Day 25: Mini Project — Parallel Archive Verifier
Bounded worker pool for file verification
Per-file and whole-run cancellation
Ordered aggregation without shared-map races
Project requirements, constraints & review Define Project requirements, leak tests, and throughput metrics in plain language and explain the problem it solves Trace what the Go compiler or runtime does when Project requirements, leak tests, and throughput metrics is used Write a tiny example, then apply it to a realistic backend task Diagnose the beginner failure mode for Project requirements, leak tests, and throughput metrics and fix it deliberately
Parallel Archive Verifier Verify thousands of research-archive files against a catalog with bounded parallel hashing, cancellation, progress events, and deterministic mismatch output.
Worker pool with measurable backpressure Prompt cancellation with partial-result accounting Race-detector-clean and goroutine-leak testsAfter this phase, you'll be able to:
Concurrency versus parallelism Starting goroutines and scheduler intuition Goroutine lifetime, leaks, and ownership WaitGroup and the add-before-go rule Unbuffered channel synchronization Buffered channels and backpressure Closing, ranging, direction types, and ownership Deadlocks, blocked sends, and protocol diagrams You can apply Phase 5 skills in a finished, explainable Go project.