Summary
We had a whirlwind tour of concurrency mechanisms. It started with the producer/consumer pipeline of Unix. Then we saw the inherent principles behind the pipeline, namely decoupling and each tool doing at least one thing. This is the essential Unix philosophy.
We looked at the recursive grep worker as an example. After the pipeline solution, we looked at the producer/consumer implementation in Java. We looked at the problems of performing multithreading by ourselves. We also saw how we need to take extreme care not to introduce race conditions.
Races can take place when there is a possibility of the same state getting updated by multiple threads. We saw one example of a leaky abstraction and how immutability helps us gain the ground back.
Keeping in mind the perils of multithreading, we looked at Akka, Scala's popular actor library. We implemented the solution using Akka actors and saw the simplicity of the messge driven concurrency paradigms.
With all this know-how under our belt...