Grokking Concurrency

Book description

This easy-to-read, hands-on guide demystifies concurrency concepts like threading, asynchronous programming, and parallel processing in any language.

Perplexed by concurrency? Don’t be. This engaging, fully-illustrated beginner’s guide gets you writing the kind of high-performance code your apps deserve. Inside, you’ll find thorough explanations of concurrency’s core concepts—all explained with interesting illustrations, insightful examples, and detailed techniques you can apply to your own projects.

In Grokking Concurrency you will:

  • Get up to speed with the core concepts of concurrency, asynchrony, and parallel programming
  • Learn the strengths and weaknesses of different hardware architectures
  • Improve the sequential performance characteristics of your software
  • Solve common problems for concurrent programming
  • Compose patterns into a series of practices for writing scalable systems
  • Write and implement concurrency systems that scale to any size

Discover effective concurrency practices that will help you leverage multiple cores, excel with high loads, handle terabytes of data, and continue working after hardware and software failures. The core concepts in this guide will remain eternally relevant, whether you’re building web apps, IoT systems, or handling big data.

About the Technology
Concurrency is an approach to running computer programs efficiently by separating them into tasks that can execute independently. This basic idea makes it possible to accelerate game graphics, train large AI models, rapidly scale web applications, streamline big data processing, and much more. Concurrency can get complicated, so this book gets you started gently with interesting examples, entertaining illustrations, and easy-to-follow Python code.

About the Book
Grokking Concurrency is a perfectly paced introduction to the fundamentals of concurrent, parallel, and asynchronous programming. In it, you’ll learn the practices you’ll need to program multicore processors, GPUs, and other high-performance systems. Author Kirill Bobrov skips the math, jargon, and academic language and concentrates on clear, plain-English explanations.

What's Inside
  • Writing and running concurrent programs
  • Patterns for performance, scalability, and resilience
  • Choosing the right hardware
  • Asynchronous communication


About the Reader
Examples in Python. No prior experience with concurrency or high-performance computing required.

About the Author
Kirill Bobrov is a software engineer with a passion for data engineering.

Quotes
I recommend Grokking Concurrency as a gentle introduction to creating programs that perform on today’s highly parallel architectures.
- Robert Robey, Los Alamos National Laboratory

This book combines computer architecture, operating systems, distributed computing, analysis, algorithms, and design. Anyone building a concurrent application should read this book first.
- David Beazley, Author of Python Cookbook and Python Distilled

A comprehensive, accessible, and practical overview of concurrent programming. It clarifies concepts like parallelism, race conditions, deadlocks, and more.
- Arnaud Bailly, IOG

Table of contents

  1. inside front cover
  2. Grokking Concurrency
  3. Copyright
  4. dedication
  5. contents
  6. front matter
    1. preface
    2. acknowledgments
    3. about this book
    4. about the author
  7. Part 1. The octopus orchestra: Introduction to a symphony of concurrency
  8. 1 Introducing concurrency
    1. Why is concurrency important?
    2. Layers of concurrency
    3. What you’ll learn from this book
    4. Recap
  9. 2 Serial and parallel execution
    1. Review: What is a program?
    2. Serial execution
    3. Sequential computations
    4. Parallel execution
    5. Parallel computing requirements
    6. Parallel computing
    7. Amdahl’s law
    8. Gustafson’s law
    9. Concurrency vs. parallelism
    10. Recap
  10. 3 How computers work
    1. Processor
    2. Runtime system
    3. Design of computer systems
    4. Multiple levels of concurrent hardware
    5. Recap
  11. 4 Building blocks of concurrency
    1. Concurrent programming steps
    2. Processes
    3. Threads
    4. Recap
  12. 5 Interprocess communication
    1. Types of communication
    2. Thread pool pattern
    3. Cracking passwords, revisited
    4. Recap
  13. Part 2. The many tentacles of concurrency: Multitasking, decomposition, and synchronization
  14. 6 Multitasking
    1. CPU-bound and I/O-bound applications
    2. The need for multitasking
    3. Multitasking from a bird’s-eye view
    4. Multitasking environments
    5. Recap
  15. 7 Decomposition
    1. Dependency analysis
    2. Task decomposition
    3. Task decomposition: Pipeline pattern
    4. Data decomposition
    5. Granularity
    6. Recap
  16. 8 Solving concurrency problems: Race conditions and synchronization
    1. Shared resources
    2. Race conditions
    3. Synchronization
    4. Recap
  17. 9 Solving concurrency problems: Deadlocks and starvation
    1. Dining philosophers
    2. Deadlocks
    3. Livelocks
    4. Starvation
    5. Designing synchronization
    6. A last few words
    7. Recap
  18. Part 3. Asynchronous octopuses: A pizza-making tale of concurrency
  19. 10 Nonblocking I/O
    1. The distributed world
    2. Client-server model
    3. Pizza-ordering service
    4. Blocking I/O
    5. Nonblocking I/O
    6. Recap
  20. 11 Event-based concurrency
    1. Events
    2. Callbacks
    3. Event loop
    4. I/O multiplexing
    5. Event-driven pizza server
    6. Reactor pattern
    7. Synchronization in message passing
    8. I/O models
    9. Recap
  21. 12 Asynchronous communication
    1. A need for asynchrony
    2. Asynchronous procedure calls
    3. Cooperative multitasking
    4. Future objects
    5. Cooperative pizza server
    6. Asynchronous pizza joint
    7. Conclusions on the asynchronous model
    8. Recap
  22. 13 Writing concurrent applications
    1. So, what is concurrency?
    2. Foster’s methodology
    3. Matrix multiplication
    4. Distributed word count
    5. Recap
  23. Epilogue
  24. index
  25. inside back cover

Product information

  • Title: Grokking Concurrency
  • Author(s): Kirill Bobrov
  • Release date: January 2024
  • Publisher(s): Manning Publications
  • ISBN: 9781633439771