Take the 2-minute tour ×
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 realised I have a massive knowledge gap when it comes to multi-threaded applications and concurrent programming. I've covered some basics in the past, but most of it seems to be gone from my mind, and it is definitely a field that I want, and need, to be more knowledgeable about.

What are the best resources for learning about building concurrent applications? I'm a very practical oriented person, so if said book contains concrete examples the better, but I'm open to suggestions. I personally prefer to work in pseudocode or C++, and a slant toward game development would be best, but not required.

share|improve this question
    
you'll find plenty here: stackoverflow.com/questions/194812/… –  alfasin Feb 18 '12 at 11:35
add comment

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

4 Answers

These are the books I have found useful lately:

Java Concurrency in Practice - by the author of much of Java's concurrency utils. Somewhat Java-specific, but very clear and informative about the dangers and pitfalls of threads.

The Art of Concurrency - not a scintillating theoretical treatise as the title suggests, in fact a rather folksy and down-to-earth compendium of useful advice and examples.

Programming Concurrency on the JVM - This one actually is a scintillating theoretical treatise, but very, very readable and insightful. If you need to know what STM or actors are, what their strengths and weaknesses are and why, this book will tell you.

There are many dedicated utility libraries such as the Intel Threading Building Blocks or Apple's Grand Central Station - these generally have their own dedicated manuals, which are usually quite good, and anyway are mandatory reading if you want to do something big with them.

share|improve this answer
add comment

I have found this free threading resource put up by Joe Albahari excellent ...

Threading in C#

Its slanted towards C# but the concepts are entirely applicable to other languages. He also provides the tutorial as a PDF download in english and several other languages. I would recommend it due to the combination of example code, step by step explanations of the code and excellent sequence and state diagrams accompanying the examples.

The tutorial is in five parts:

Its available in book form here: C# 4.0 in a Nutshell (chapters 23 and 24)

share|improve this answer
1  
+1, this is my usual "go-to" reference for threading/concurrency/parallelism in .NET –  MatthewKing Apr 16 '12 at 4:58
add comment

the best book on concurrency i ever read is The Art of Multiprocessor Programming by Maurice Herlihy and Nir Shavit

share|improve this answer
3  
Can you qualify why this is the case? –  World Engineer Apr 16 '12 at 4:23
    
you can refer to comments on amazon website, it's here link, my experience is, its material is both broad and deep. –  xwlan Apr 16 '12 at 11:41
add comment

There are now threading facilities in the C++ standard. So if you want to learn in C++, I suggest reading a simple review of the new language feature before heading over to a generic threading tutorial. Then go back and review the standard in more detail later.

In practice, threading is one of those things that most people think they understand, but don't. I went to a talk from a static analysis researcher who identified race conditions in an IBM research database (Java), in a linux filesystem (C), and in some other pretty high-profile projects. Some of the projects were written by respected experts in concurrency and threading. Be aware that making thread-safe code is difficult and that the knowledge gap is not exclusive to those who recognize it in themselves.

Though it will not directly help you in game programming, I would recommend looking at some MPI tutorials (sorry, no specific recommendations). While it seems difficult to write correct concurrent code with threads, it seems rather easy to do it with message passing. Indirectly, the hope is that exploring different concurrency models will help your own thought process on structuring your code to be thread-safe.

share|improve this answer
add comment

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.