Fun Java Deadlock Puzzle →
A fun Java concurrency problem has been seen around some corners of the internet. I'm not sure of the real origin of this problem, but I was introduced to it from a friend of a friend who saw a poster somewhere around an Amazon stand at some software engineering conference. It centers around a simple Java class ThreadNinja which uses reckless synchronization around methods and is designed to generate a deadlock. The goal is to describe a scenario in which a deadlock would occur. The puzzle part if not too puzzling, but not obvious at first glance, so I thought I'd throw in my two cents and maybe show some code that could be used to prove (and I use the term lightly) the outcome.
Read More