Wednesday, June 15, 2016

Top 5 Books to Learn Concurrent Programming and Multithreading in Java - Best, Must Read

Books are very important to learn something new and despite being in the electronic age, where books have lost some shine to internet and blogs, I still read and recommend them to get a complete and authoritative knowledge on any topic e.g. concurrent programming. In this article, I will share five best books to learn concurrent programming in Java. These books cover basics, starting from how to create and start a thread, parallel programming, concurrency design patterns, an advantage of concurrency and of course pitfalls, issues, and problems introduced due to multithreading. learning concurrent programming is a difficult task, not even in Java but also on other languages like C++ or modern days JVM languages like Groovy, Scala, Closure, and JRuby.

Since I have been doing active Java development from more than 10 years, I can say that this is the best language to start with concurrent programming, because of its structure, inbuilt concurrency support in terms of synchronized, volatile, and final keyword, and finally because a wealth of information available in internet and community.

Anyway, there is no substitute for writing code and learning from a mistake but you need a book which can guide, educate and teach you, what others have already learned in threads, concurrency, and parallel programming.

Top 5 Multithreading and Concurrency Books for Java Programmers

Here is my list of books to master thread basics, multi-threading gotchas and principles and patterns of concurrent programming in Java. They will not only teach you what to do but also what not to do. Since multi-threading is a tricky topic, it's better to refer more than one book because you will find you connect to some author better than others.

The Art of Multiprocessor Programming
Ideally, this book should be the first book any programmer read on concurrent and multiprocessor programming, it covers academic stuff like classical producer-consumer and readers-writers problem, and explains some fundamentals of multiprocessors and shared memory.

The Art of Multiprocessor Programming  Revised by Maurice Herlihy and Nir Shavit is also must read for any Java developer, who just know how to use a thread Java but not familiar with essential principles of concurrent programming e.g. critical section, mutual exclusion, locking, shared memory, memory barriers and synchronization etc. I must say, you got to read this book to know its true value, it just amazing.

In short, a truly awesome book and must read for not just Java programmer but anyone who wants to learn basics of concurrent programming e.g. C++, C#, Scala.

books to learn concurrent programming

Java Thread 3rd edition 
The first book I have read, particularly in Java multi-threading was the Java Thread 2nd edition by Scott Oaks and Henry Wong. The book is awesome and it teaches basics of creating a thread and how to use them with some  simple yet non-trivial example. They have one of the best chapters on teaching, how to use wait and notify mechanism in Java.  The only drawback of 2nd edition was then it has  not covered new concurrency classes like CountDownLatchCyclicBarrier, or Semaphore introduced in Java 1.5.

The new, Java Thread 3rd edition fills that gap and now it covers all those new concurrency and synchronization utilities of J2SE 5.0. IF you are a beginner, doesn't know much about what is a thread, how do they help and how to use them to create a multi-threaded application, This is the book, you should read.

Though this book focuses on Java programming language, it also a useful for learning basics of threading, if you want to start with other JVM language e.g. Scala.

best book to learn threads in Java

Java Concurrency in Practice 
Many of hardcore fan of Java Concurrency in Practice will be furious by not keeping this book at the top of this list. Well, I have ordered the book from beginner programmers to advanced programmers, and this book certainly covers the advanced aspect of Java concurrency. By the way, If you ask me to recommend just one book on concurrency and multi-threading to a Java programmer, I would recommend this one.

Java Concurrency in Practice is the bible of concurrency and concurrent programming for Java developer and a must-read for anyone serious about concurrent programming. There are a lot of good things about this book, starting from their icons for showing bad practices, and them improving them.

One of the highlights is their terminology, which is just crystal clear, very important when you are explaining a complex and confusing topic. Another highlight is their author group, which includes Java concurrency expert Brian Goetz, Joshua Bloch who has written Effective Java and Java Collection API, Doug Lea, author of many classes in java.util.concurrent package e.g. the ConcurrentHashMap, one of the most used concurrent collection in Java.

In one word, every Java developer must have a copy of Concurrency Practice in Java in their book self and smartphone for reading whenever they have some time.

best book to learn concurrency in Java

Concurrent Programming in Java: Design Principles and Patterns 
This book is another gem on concurrency and multi-threading from Doug Lea. This book is also meant for experienced and senior Java programmers, who knows basics of multithreading in Java and bit of concurrency as well.

This book explains lots of design, patterns, and details about inbuilt synchronization features of Java programming language. Many of patterns and design explained in this book is used by Doug Lea while implementing java.util.concurrent package. This books can be best utilized by following examples and looking at concurrency code written Doug Lea itself.

This book also covers Java Memory Model, which is very important for any Java programmer. Though I suggest reading Java Memory Model chapter from Java concurrency in Practice for any beginners first because of its language which is slightly easier to understand.

best book to learn concurrent design patterns in Java

Programming Concurrency on the JVM
This is a relatively new book in the field of concurrent programming, synchronization and multi-threading. This is written by one of my favorite author, Venkat Subramaniam, this not only explains concepts in Java but also in other JVM programming language e.g. Scala, groovy, closure, and JRuby. The main highlight of this book is Software Transnational Model(STM) and Actor-based concurrency. This book explains new techniques of concurrent programming which allow you to compare and choose leading edge stuff. This books lot of new stuff in a table which is I guess it's best selling point.

best book to learn concurrency in JVM

These were my top 5 Java Concurrency and multi-threading books, will help to learn concurrent programming and taking advantage of today's advanced multi-core processors. All the books are useful for both beginners and experienced Java programmer to fill gaps on basics and learn tried and tested concurrent design principles, patterns, best practices and things to avoid. having said that, let us know if you find any other good books on Concurrency and threading.

Further Learning
Java Fundamentals Part 1,2
Applying Concurrency and Multi-threading to Common Java Patterns

P.S. - If you are looking for a complete set of Java book to become an expert Java developer, you must see 10 Java books for experienced programmers.

P.S. - If you want to improve your coding skill irrespective of any programming skill then you should check out these 5 timeless classic coding books.


Animesh Kumar said...


Ch!rag said...

Great collection, Thank you !!!

Gupta said...

Nice Collection.. Thanks.

Javin Paul said...

@Animesh, @Chirag, and @Gupta, Thank you guys, feel free to suggest any book which you find good in threads, and concurrent programming and not in this list.

Amrish Pandey said...

I am 70% complete with Programming concurrency on JVM. This book is totally worth it. Its meant only for senior java developers, not for basics of multi threading

Javin Paul said...

Thanks @Amrish, for sharing your experience. Programming Concurrency on JVM is definitely a great book to learn advanced concurrency patterns and models e.g STM and Actor based concurrency.

Post a Comment