On Wednesday, I gave a talk at our local Ruby Brigade meeting on the fundamentals of concurrency. The topic is easily one of the top two that I’m grateful to have been exposed to in college. (The other topic is database fundamentals.) Systems suffering from concurrency issues are very difficult to debug, and if you haven’t been exposed to these types of issues and how they happen, they’d be quite difficult to figure out on your own.
The talk introduces race conditions, deadlock and starvation, and uses many examples to ensure beginners (and even non-programmers) can follow. It then introduces approaches to avoiding these issues, such as using mutexes to ensure that only one program of a participating group can execute code in its critical region at a time, or, using semaphores to manage resources that need to be shared.
I’ve made available for download the keynote slides for the presentation, as well as the Perl scripts I created to demonstrate a website hit counter suffering from concurrency issues, and one that didn’t. Unfortunately, since the talk wasn’t recorded, I’m unable to include a video showing volunteers working through the Dining Philosophers problem, but an algorithm for doing so is included in the slides (which I obtained from a recorded Stanford lecture on programming paradigms).
Feel free to use the slides and the Perl scripts in your own talk. As a courtesy, but not a requirement, please let me know if you do.
Leave a Reply