Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 2.35 KB

README.md

File metadata and controls

45 lines (32 loc) · 2.35 KB

Go Concurrency: From Basics to Advanced

This repo is my personal knowledge base on goroutines and concurrency in Go. It includes notes and examples to help quickly understand these concepts and build concurrent programs.

📋 Topics Covered

1️⃣ Concepts

  • 📘 Fundamentals: Processes, Threads, OS concepts.
  • ⚙️ Go Scheduler: How the Go runtime manages goroutines.
  • 🔍 Comparison: Concurrency, parallelism, async programming.

2️⃣ Basics

  • 🌀 Goroutines: Lightweight threads in Go.
  • WaitGroup: Coordinating goroutine completion.
  • 📡 Channels: Communication between goroutines.

3️⃣ Sync Tools

  • 🔒 Mutex: Mutual exclusion for critical sections.
  • Atomic: Low-level atomic operations.
  • 📣 Cond: Signaling between goroutines.
  • 🔂 Once: Ensuring a task runs only once.
  • 🏊 Pool: Reusable object pools.
  • 🗺️ Map: Concurrent-safe maps.

4️⃣ Advanced

  • 🌐 Context: Managing deadlines, cancellations.
  • 📬 Select Statement: Handling multiple channel operations.
  • 🛑 Deadlock: Detecting and avoiding deadlocks.
  • ⚠️ Data Race: Understanding and fixing data races.

5️⃣ Patterns

  • Cancellation: Graceful task cancellation.
  • ➡️ Fan-out: Distributing tasks to workers.
  • ⬅️ Fan-in: Aggregating results from workers.
  • 🔄 Fan-out & Fan-in: Combining fan-out and fan-in.
  • 🔗 Pipeline: Processing data through stages.
  • 🚦 Semaphore: Controlling access to limited resources or tasks.
  • 📡 Pub/Sub: Message broadcasting between publishers and subscribers.

💡 Feel free to explore, contribute, and improve this knowledge base!