The dining philosophers problem comes to mind, which originally was formulated by Dijkstra [0]. You can find implementations in different languages at Rosetta code [1]
[0] https://en.wikipedia.org/wiki/Dining_philosophers_problem [1] https://rosettacode.org/wiki/Dining_philosophers