W1W2W3W4W5W6W7W8

Lessons

Week 1Project setup and rate limiting0/24
Week 2Restaurants and menus with MySQL0/20
Week 3Authentication, orders and Kafka events0/20
Week 4Customer application with Expo0/18
Week 5Live order tracking and rider management0/14
Week 6Performance, caching and load testing0/14
Week 7Deployment and production operations0/14
Week 8Advanced features and project documentation0/8
ReviewQuiz questions that are due
ResourcesReading list, by week

Mutex

A mutex is a synchronization primitive that allows only one goroutine at a time to access a protected section of code. In Go, sync.Mutex provides Lock and Unlock methods for coordinating access to shared mutable state.

Minimal example

go
var mu sync.Mutex
var count int

func increment() {
    mu.Lock()
    defer mu.Unlock()
    count++
}

Learn this concept

Lesson 1.10 · Mutexes and time: making a limiter safe and testable

Used in exercises

Exercise 1.11 · Token bucket limiter with lazy refill Exercise 1.14 · Limiter interface and a FixedWindow implementation Exercise 1.15 · Table-driven tests with a fake clock, plus one race test Exercise 1.22 · Redis fixed-window limiter that fails open Exercise 1.26 · Optional: Sliding window log limiter Exercise 1.27 · Optional: Sliding window counter limiter Exercise 1.28 · Optional: Leaky bucket limiter Exercise 1.29 · Optional: Token bucket in Redis with Lua and EVALSHA Exercise 5.3 · Per-user WebSocket hub Exercise 5.13 · Hub broadcast and claim race tests Exercise 5.16 · Topic subscription registry Exercise 6.15 · Runtime feature switches
Prerequisite conceptsGo structsGo methods and receivers
RelatedGoroutinesData raceToken bucketInjected clock