Ace Java 2025: Rock Your 'Thinking in Java' Challenge!

Question: 1 / 510

How do philosophers prevent deadlock when acquiring chopsticks?

By asking politely

By taking them in a specific sequence

When acquiring chopsticks, philosophers use a specific sequence to prevent deadlock. This means that they take turns in a predetermined order to obtain their chopsticks, rather than all attempting to acquire them at the same time. This avoids a stalemate situation where no one is able to obtain the chopsticks. The other options are incorrect because asking politely does not necessarily guarantee fairness in obtaining the chopsticks, using one chopstick would not suffice for eating, and using a global lock would also create a deadlock as everyone would be trying to access the same resource at once.

Get further explanation with Examzify DeepDiveBeta

By only using one chopstick

By using a global lock

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy