Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications

Categories

🎓 Certifications
🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
CheatGrid
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications
LVLEVEL 0
0/5 XP
GitHub
© 2026 CheatGrid™. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Concurrency and Parallel Programming Patterns Cheat Sheet

Concurrency and Parallel Programming Patterns Cheat Sheet

Back to Software Engineering
Updated 2026-05-28
Next Topic: Contract Testing Cheat Sheet

Concurrency is the ability to execute multiple tasks in overlapping time periods, while parallelism executes multiple tasks simultaneously on multiple cores or processors. These concepts are fundamental to building performant, responsive software systems that leverage modern multi-core hardware. The key challenge lies not in spawning threads or processes, but in coordinating their access to shared resources without introducing subtle, hard-to-reproduce bugs. Understanding the distinction between concurrency models (threads, processes, coroutines, virtual threads), synchronization primitives (mutexes, semaphores, barriers), and common pitfalls (race conditions, deadlocks, false sharing) transforms concurrent programming from an intimidating minefield into a structured engineering discipline with predictable trade-offs and proven patterns.

What This Cheat Sheet Covers

This topic spans 11 focused tables and 92 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Concurrency ModelsTable 2: Synchronization PrimitivesTable 3: Common Concurrency BugsTable 4: Parallel Programming PatternsTable 5: Lock-Free Programming ConceptsTable 6: Memory and OrderingTable 7: Async and Reactive PatternsTable 8: Thread Coordination TechniquesTable 9: Performance and ScalabilityTable 10: Concurrency Control StrategiesTable 11: Common Antipatterns and Fixes

Table 1: Concurrency Models

Concurrency and parallelism are realized through a variety of execution units — each with different scheduling, memory, and overhead characteristics. Choosing the right model up-front determines everything from thread-safety surface area to scalability ceiling.

ModelExampleDescription
Thread
std::thread t(func);
t.join();
• OS-managed execution unit sharing process memory space
• preemptively scheduled by kernel
• ~1MB stack overhead per thread
• suitable for CPU-bound parallel work.
Process
fork() in Unix
multiprocessing.Process() in Python
• Independent execution unit with separate memory space
• isolated from other processes
• higher creation/context-switch cost
• communicates via IPC
• avoids shared-memory race conditions.
Coroutine
async def fetch():
await http.get(url)
• Cooperatively-scheduled function that can suspend and resume execution
• lightweight (~KB overhead)
• ideal for I/O-bound tasks
• requires explicit yield points
• avoids preemption overhead.
Goroutine
go func() { ... }()
• Go's lightweight threads managed by Go runtime
• multiplexed onto OS threads (M:N model)
• starts with 2KB stack that grows dynamically
• extremely cheap to spawn thousands.
Virtual Thread
Thread.startVirtualThread(
() -> blockingOp());
Executors.newVirtualThreadPerTaskExecutor()
• JVM-managed lightweight thread (Java 21+, JEP 444) that unmounts from its OS carrier thread during blocking
• millions can run concurrently on modest hardware
• enables thread-per-task style without reactive complexity for I/O-bound workloads

More in Software Engineering

  • Code Smells and Anti-Patterns Cheat Sheet
  • Contract Testing Cheat Sheet
  • _Dependency_Injection_Patterns
  • Distributed Systems Core Concepts Cheat Sheet
  • Modular Monolith Architecture Cheat Sheet
  • Software Engineering Cheat Sheet
View all 47 topics in Software Engineering