Now, in 2nd edition!
With the rise of multicore processors, the era of concurrency is at our doorstep. Long considered an arcane skill understood only by a handful of experts, the need to master concurrent programming has never been greater. Fortunately, this rapid shift in processor technology has resulted in novel, high-level concurrency utilities, designed to make concurrent programming more accessible. The Scala programming language proved to be an ideal spawning ground for the developments in concurrent programming, and its unique set of features supports a rich ecosystem of concurrency libraries today. This variety of different frameworks allows concurrent software systems to be built more intuitively and easily.
This book will give you an insight into the best practices necessary to build concurrent programs in Scala using modern, high-level concurrency libraries. It starts by introducing you to the foundations of concurrent programming on the JVM, outlining the basics of the Java Memory Model, and then shows some of the classic building blocks of concurrency, such as the atomic variables, thread pools and concurrent data structures, along with the caveats of traditional concurrency. It then walks you through different high-level concurrency abstractions, each tailored towards a specific class of programming tasks.
The book teaches you how to express deterministic asynchronous programs, shows how and when to use data-parallelism, and explains the use cases for first-class event streams. You will learn to express scalable, transactional shared-memory data models, and techniques to write distributed programs easily. Finally, the book presents an overview of when to use which concurrency library and demonstrates how they all work together.
This book is a must-have tutorial for software developers aiming to write concurrent programs in Scala, or broaden their existing knowledge of concurrency. It is intended for Scala programmers that have no prior knowledge about concurrent programming, as well as those seeking to broaden their existing knowledge about concurrency. Basic knowledge of the Scala programming language will be helpful and readers with a solid knowledge in another programming language, such as Java, should find this book easily accessible.