I've read various bits and pieces on concurrency, but was hoping to find a single resource that details and compares the various approaches. Ideally taking in threads, co-routines, message passing, actors, futures... whatever else that might be new that I don't know about yet!
Would prefer a lay-coders guide than something overtly theoretical / mathematical.
Thank you.
There are two common models for concurrent programming: shared memory and message passing. Shared memory. In the shared memory model of concurrency, concurrent modules interact by reading and writing shared objects in memory.
Java, C# and C++ are three well-known languages with good support for concurrency.
In concurrent programming, an execution of a program segment is called a process. For example, when, logged into a time-sharing system, you invoke the electronic mail program, a process is created. The mail program itself is just a file on disk; when it is loaded into memory and executed, that execution is a process.
Concurrent programming can be used for speci cation, simulation, and control of discrete- event systems. It is based on a view of a system as a collection of active, interacting with each other, components.
I recommend An Introduction to Parallel Programming by Pacheco. It's clearly written, and a good intro to parallel programming.
If you don't care about something being tied to a language, then Java Concurrency in Practice is a great resource.
Oracle's online tutorial is free, but probably a bit more succinct than what you're looking for.
That being said, the best teacher for concurrency is probably experience. I'd try to get some practice, myself. Start out by making a simulation of the Dining Philosophers problem. It's a classic.
At first, let's see if you're interested in the topic or not. To grasp a big picture about concurrency, best practice is to take a look at operating systems books, like Operating systems internal by Stalings or Modern operating systems by Tanenbaum. They can give you an intuition about what this is all about.
There's also an old book, named Concurrent programming by Ben-Ari. If you found it, it can be helpful.
Beside reading text books it's good get your hands dirty by writing some concurrent programs. Python is a very good choice if you want to start using threads. Every Python book has a part dedicated to this topic. Also a with a simple search on the web you can find a lot of resources about it, but I give these two higher preference:
Multithreaded Programming (POSIX pthreads Tutorial), A very comprehensive introduction to concurrency and multi-threading. It's mainly about C multi-threading.
The other one is Thread Synchronization Mechanisms in Python.
Now if you still find yourself interested about concurrent programming, it's time to go deeper. You almost have the basic knowledge of concurrency, now the best approach at this point is to start solving problem and become familiar with patterns. To achieve this goal, you can use The Little Book of Semaphores. It's one of best books in the field and it's also free. This is a book that can head you toward becoming proficient at concurrent programming.
These should be enough if you want to approach concurrent programming, but if you have enough time, and you're eager, it's good to take a look at some other paradigms of concurrent programming, like actors which are used in Erlang. I say it is worth to read some chapters of the book Seven Languages in Seven Weeks, especially chapter about Erlang and IO. At first glance, it might be hard and strange, but it's good to become familiar with other solutions to concurrency.
I would recommend Concepts, Techniques, and Models of Computer Programming from Peter Van Roy and Seif Haridi. All the major programming techniques have a follow up sections on concurrent programming. Also the author starts with basics and defines the main concurrent programming concepts, their shortcomings, all accompanied with examples in Oz programming language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With