# Dining Philosophers in Java 8

DevFeed: [Dining Philosophers in Java 8](<https://devfeed.tech/articles/dining-philosophers-in-java-8-32218.md>)

Original publisher: [Read original article](<https://bruceeckel.com/2016/12/29/dining-philosophers-in-java-8/>)

Author: Bruce Eckel

Published: 2016-12-29T00:00:00Z

Content type: tutorial

Language: en

Sources: [Bruce Eckel - Computing Thoughts](<https://devfeed.tech/sources/bruce-eckel-computing-thoughts.md>)

Topics: [Deadlock](<https://devfeed.tech/topics/deadlock.md>), [Java](<https://devfeed.tech/topics/java.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>)

Tags: [concurrent](<https://devfeed.tech/tags/concurrent.md>), [deadlock](<https://devfeed.tech/tags/deadlock.md>), [java](<https://devfeed.tech/tags/java.md>), [java-8](<https://devfeed.tech/tags/java-8.md>), [thread](<https://devfeed.tech/tags/thread.md>)

## AI overview

This tutorial explains deadlock in concurrent programs through the Dining Philosophers problem and presents a Java 8 example using shared chopsticks and blocking queues.

## Source excerpt

Because tasks can become blocked, it's possible for one task to get stuck waiting for another task, which in turn waits for another task, and so on, until the chain leads back to a task waiting on the first one. You get a continuous loop of tasks waiting on each other, and no one can move. This is called deadlock.1 If you try running a program and it deadlocks right away, you can immediately track down the bug.