Book Image

Concurrent Patterns and Best Practices

By : Atul S. Khot
Book Image

Concurrent Patterns and Best Practices

By: Atul S. Khot

Overview of this book

Selecting the correct concurrency architecture has a significant impact on the design and performance of your applications. Concurrent design patterns help you understand the different characteristics of parallel architecture to make your code faster and more efficient. This book will help Java developers take a hands-on approach to building scalable and distributed apps by following step-by-step explanations of essential concepts and practical examples. You’ll begin with basic concurrency concepts and delve into the patterns used for explicit locking, lock-free programming, futures, and actors. You’ll explore coding with multithreading design patterns, including master, slave, leader, follower, and map-reduce, and then move on to solve problems using synchronizer patterns. You'll even discover the rationale for these patterns in distributed and parallel applications, and understand how future composition, immutability, and the monadic flow help you create more robust code. By the end of the book, you’ll be able to use concurrent design patterns to build high performance applications confidently.
Table of Contents (14 chapters)

Summary   


We looked at two important themes in this chapter. An immutable value is never changed once it is constructed. Immutability rules out, by design, any shared state issue as you cannot change the values. Immutable code makes for increased thread safety. Copy-on-write is used when a thread needs to modify an immutable data structure. We looked at persistent data structures, which are multiple versions (copies) of the same data structure. Structural sharing helps ensure algorithmic performance. 

Next, we looked at Scala's futures, an abstraction used to express asynchronous computations. We saw how futures map with threads, and how to avoid blocking the underlying thread. Futures allows for functional composition—a functional design pattern for creating processing pipelines.   

With all this know-how, let's now look at the Actor paradigm. Stay tuned!