Skip to content

Master Go concurrency, from fundamentals to advanced patterns

Notifications You must be signed in to change notification settings

darkvard/go-concurrency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Master Go concurrency, from fundamentals to advanced patterns

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages