Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm looking for a book with a broad, comprehensive overview of concurrent programming. A lot of books focus on one language, platform, or concurrency technique. I'm more interested in a book that explains all different ways of achieving concurrency:

  • shared memory multithreading
  • message passing between threads
  • piped interprocess
  • socket interprocess
  • microthreads
  • transactional memory
  • other ones I don't know about yet

I want to be able to confidently choose a concurrency technique based on the problem at hand.

share|improve this question
reading a book (any book) won't make one able to confidently choose a concurrency technique based on the problem at hand – gnat May 25 '12 at 14:59
aren't socket and piped interprocess both forms of message passing? (just with different locations of the receivers of the message) – ratchet freak May 25 '12 at 15:02
@gnat: Sure it won't make me an expert, but it would be better than nothing. – japreiss May 25 '12 at 15:30
@ratchet freak: Edited, I meant specifically message passing implemented with threads instead of processes. I guess they are not that different... – japreiss May 25 '12 at 15:30
@japreiss well, of the books I studied, POSA Vol 2, Patterns for Concurrent and Networked Objects appear to be a good match. Challenging and quite rewarding reading. "Real-life" examples provided for some patterns are true gems (restaurant chief as Active Object etc). In addition, I'd strongly recommend to pick and study something focused on language of your choice: besides conceptual understanding, one needs sharp, focused tools in concurrency – gnat May 25 '12 at 15:42
show 1 more comment

5 Answers

This one maybe: http://www.amazon.com/The-Multiprocessor-Programming-Maurice-Herlihy/dp/0123705916

I'm working on it. It's deep. The author will send you answers to exercises if you ask for them.

share|improve this answer
+1 It is going to take me years to digest this book, but it's certainly one of the best I have seen. The first couple of chapters contain a set of metaphors that are trully valuable to understand deeper concepts presented later, but this is not the kind of book one simply reads and understands everything at once. It's true, the author sent me the answer upon request. – edalorzo May 25 '12 at 23:36

Some of those techniques are described in programming-concurrency-on-jvm Really like that book language and concurrency stuff explained very detailed there.

share|improve this answer
1  
Does that book contain information that would still be useful on other platforms? – japreiss May 25 '12 at 15:31
@japreiss What do you mean by "other platforms"? The advantage of the JVM is that it is platform independent. JVMs are available for all common operating systems. And many programming languages (Java, Scala, Clojure, JRuby, etc.) run on the JVM. – faif May 25 '12 at 16:57
@japreiss if you want to know about generic principles you need different literature than if you just want to know the tools available in your current toolbox. – user1249 May 25 '12 at 17:29

It's not a book but this is a fantastic presentation which might help you: http://www.infoq.com/presentations/Lock-free-Algorithms#HN2

It digs down into the interaction between threads and CPUs at the cache & CPU core register levels.

Though Java specific, also take a look at the Java Memory Model. A significant but misunderstood part of multi-threading is synchronisation and visibility of data, and almost any multi-threaded platform will have to solve this in one way or another.

share|improve this answer

If you are using Java, This is the best book

Java concurrency in Practice

Even if you are not using Java, This book will help you.

share|improve this answer

Warning: this is really more of an extended comment than an answer, primarily pointing to the fact that the question needs a lot of clarification before anybody can provide a really good answer.

I doubt there's any one book that's really (even close to) comprehensive. If there was, you'd need a forklift to move it. Books that cover even a fairly small subset of possibilities are still generally non-trivial.

I'd also note that you really seem to be conflating two rather separate issues: concurrency itself, and inter-task communication (whether the tasks happen to be implemented with threads, actors, processes, etc.) In some cases, one largely determines the other (e.g., an actor model generally specifies the forms of communication available) but in others that's much less true (e.g., most threading libraries support a fairly wide range of communication models).

It also seems to me that the answer(s) you're asking for are largely undecided at the present time. Quite a few people have formed opinions about things like threads vs. actors, but I don't think there's anything close to universal agreement about when to favor one over the other. Quite the contrary, I think it's pretty safe to say that this is an area where disagreement is currently the norm (at best, there might be some agreement at a rather vague level about the general sort of system that's likely to favor one or the other.

A great deal also depends on your real goals. If you want to implement something like a distributed operating system, chances are that a book on using some particular threading API will be of marginal use at best. Conversely, if you want to write a multithreaded application in Java, a book covering MESI vs. MOESI caching protocols will be at least equally remote from anything you care about.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.