From the course: Parallel and Concurrent Programming with Java 1

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Abandoned lock

Abandoned lock - Java Tutorial

From the course: Parallel and Concurrent Programming with Java 1

Start my 1-month free trial

Abandoned lock

- Now that we figured out how to avoid a deadlock between our two philosophers using chopsticks, we can return to our routine of eating and philosophizing. I'm ready for another piece of sushi so I'll pick up the first chopstick, then the second one. And I think I left the refrigerator open. - Oh, that was rude of him. We've entered another form of a deadlock through thread death. If one thread or process acquires a lock, and then terminates because of some unexpected reason, it may not automatically release the lock before it disappears. That leaves other tasks like me stuck waiting for a lock that will never be released and getting hungry. - Sorry about that. Let's look at some code.

Contents