Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Learning Concurrent Programming in Scala - Second Edition Paperback – February 22, 2017
Frequently bought together
Customers who bought this item also bought
Customers who viewed this item also viewed
About the Author
Aleksandar Prokopec, who also authored the first edition of this book, is a concurrent and distributed programming researcher. He holds a PhD in computer science from the Ecole Polytechnique Federale de Lausanne, Switzerland. He has worked at Google and is currently a principal researcher at Oracle Labs. As a member of the Scala team at EPFL, Aleksandar actively contributed to the Scala programming language, and he has worked on programming abstractions for concurrency, data-parallel programming support, and concurrent data structures for Scala. He created the Scala Parallel Collections framework, which is a library for high-level data-parallel programming in Scala, and participated in working groups for Scala concurrency libraries, such as Futures, Promises, and ScalaSTM. Aleksandar is the primary author of the reactor programming model for distributed computing.
If you buy a new print edition of this book (or purchased one in the past), you can buy the Kindle edition for only $2.99 (Save 82%). Print edition purchase must be sold by Amazon. Learn more.
For thousands of qualifying books, your past, present, and future print-edition purchases now lets you buy the Kindle edition for $2.99 or less. (Textbooks available for $9.99 or less.)
Top customer reviews
There was a problem filtering reviews right now. Please try again later.
I'm always skeptical of buying PACKT books because I think they rush to capitalize on the latest trends at the cost of editorial review. This one is an exception.
The biding is very poor. I received the book today and after reading 2/3s the pages are already falling apart. I would not mind as much if it was a cheap book.
On the content side, I have a lot of applications made with jruby that use actors (celluloid) and some with just regular threads. I learned enough to improve even them. I strongly recommend the book.
I also bought the Kindle version. It might be something personal, but I cannot read computer books on the ipad or kindle. I still order so I can refer on the go, if needed.
The book starts by presenting the basics of JVM threading and memory model, which serves as the basic . Although this is more low-level than the rest of the concurrency frameworks in the book, the book does a good job arguing why you need to understand basic JVM concurrency, and when to use threads, locks and monitors. Chapter 3 shows the classic concurrency abstractions, such as concurrent data structures, atomics, and thread pools, and explains lock-free programming. Chapter 4 is where the fun begins - it explains the futures and promises concurrency package, shows how to use it for asynchronous programming, how to functionally compose asynchronous computations, how to write new future combinators using promises, shows how to do proper cancellation and blocking in futures, and explains the Scala Async framework. Chapter 5 introduces parallel collections, shows how they differ from normal collections, discusses operations that can be parallelized, shows how to implement custom parallel operations, and how to evaluate performance in your programs. Chapter 6 introduces Rx, asynchronous programming framework based on first-class event streams, and shows how Rx can be used to build user interfaces and streaming applications. Chapter 7 deals with software transactional memories, discusses how STMs work, shows how to avoid side-effects in transactions, how to execute transactions conditionally, explains how transactional collections work, and, importantly, illustrates how easy it is to create a custom transactional, thread-safe collection. Chapter 8 introduces actor programming using Akka, and covers asynchronous message sends, starting and looking up actors, the basics of actor supervision, as well distributing the application across multiple computers. While Akka is not completely covered in this book, as it is a big topic, this chapter teaches the essentials of Akka, and you will be able to write actor programs after you're done. Chapter 9 shows how to achieve scalability and top performance in concurrent applications, what are the common types of errors in concurrent applications, and how to debug them, and, finally, how to combine different concurrency technologies to build a real-world application - a remote file browser. This is the longest chapter, and arguably, it could have been split into two separate chapters.
This is a hands-on book. Every concurrency concept is introduced through a minimal, self-contained example, and you are encouraged to code and try the examples yourself. In almost all places in the book, there is a snippet or a minimal example program that demonstrates or proves the preceding claim. Terms like starvation, deadlock, false sharing and rollbacks are never introduced without the corresponding example program that shows how these effects manifest themselves in practice. These programs are minimal examples, but are realistic and capture the essence of the corresponding real-world programs. I'm sure that, after having written and run the examples, the reader will have no problem recognizing the same effects in practice.
Every chapter is concluded with a list of references, and practical program assignments, which test the knowledge from the corresponding chapter, and, in some cases, touch more advanced topics.
What I especially liked about this book is that the author shows how different concurrency libraries can be used together. As an occasional by-stander in the Scala world, I've often witnessed propaganda and bias towards specific concurrency technologies. This is not the case only with Scala and its concurrency libraries, but also more broadly, with most programming technologies - proponents of specific programming technologies need to ruthlessly advertise their own frameworks to survive. As a result, they sometimes claim that their technology is the best, applicable to every problem or superior to alternatives. The author dismisses such attitude in two ways. First, he explains the underlying motivations for various concurrency primitives and shows their typical use-cases and usage scenarios. In doing so, he teaches the reader what a specific concurrency construct is most appropriate for. Second, he shows that concurrency primitives coming from different frameworks are not incompatible or mutually exclusive, but that they can and should be used together to tackle a task. For example, futures are ideal for issuing remote procedure calls or asynchronous requests, but parallel collections are more efficient for data-intensive tasks. Actors are great for distributed applications, but software transactional memory composes complex state and allows concurrent access to data. Still, the future can start a data-parallel computation or a transaction, and an Rx stream can send messages to an actor - these primitives support each other.
What I'd wish to see more of are advanced concurrency concepts - how does one write his own concurrent data structure, or implement more advanced applications. The book touches performance engineering and achieving best program speeds, and, having read about it, I'd love to learn more. Perhaps a follow-up book about more advanced concurrent programming will address this. Still, this is overall a great book, and will teach you how to think about concurrent programming. I recommend it as an introductory book on concurrent programming, and modern concurrency paradigms.
The book starts out with elementary concurrency building blocks. Each subsequent chapters builds on the blocks seen before, to introduce higher level abstractions, which make it easier to write more complex concurrent programs. At the same time, you won't be lost if you are only interested in later chapters: every chapter gives you sufficient context to understand it in isolation.
I love that there are exercises that come with every chapter. They are by no means easy, but very fun and engaging. Many of them are not just programming tasks, but require you to sit down with pen and paper and think for a while. As a result the book satisfies two types of audiences:
- The seasoned Scala developer who needs to refer to a resource every once in a while
- A newbie who wants to learn about concurrent programming in general, and who is interested in building practical solutions with this knowledge. I definitely fall in this category of people, and am now completely hooked.
All in all, this book strikes a pedagogical balance between being a text book and a reference book. Studying it cover to cover (and trying to solve some of the exercises) will give you great insights about concurrent programming.
The only issue I have is with the quality (or lack thereof) of the illustrations/pictures. They have a poor scan look, they could definitely be much improved. Also, I wonder if there is going to be some sort of answer key, at least for a selected subset of the exercises.
Get your copy now!