4 ms·
Does anyone know of a collection of coding problems like "Dining Philosophers" for working through common concurrency scenarios and synchronization issues?
by Dowwie 6y ago
Does anyone know of a collection of coding problems like "Dining Philosophers" for working through common concurrency scenarios and synchronization issues?
- vanderZwan 6y agoI assume you're already familiar with Rosetta Code and are asking for something subtly different? https://rosettacode.org/wiki/Dining_philosophers https://rosettacode.org/wiki/Dining_philosophers
- Dowwie 6y agoThis is what I was referring to. I'm looking for a collection of these.
- IdiocyInAction 6y agoThere's the "Little Book of Semaphores".
- imtringued 6y agoHere is an easy (or extremely hard) problem. Build a 2d grid with two objects. A chest and a hopper. Chests and hoppers are containers that hold up to 64 items. When a hopper (they can point in 4 directions) is pointing at a chest it will insert its inventory into the chest, until the chest is full (one item at a time). If there is a chest on the funnel side of the hopper then extract items from the chest and put the items into the hopper (again one item at a time). Chaining hoppers is allowed. Now go out and enjoy multithreading hell. Hint: through weird contortions it is possible to do this without any synchronization and keep it data parallel at the same time. If you did this in a production codebase you would be the only person on the planet that will understand the code.