Closed sbastrakov closed 4 years ago
I like the idea, it's a nice demonstration.
Then, unless @michaelsippel has objections, I could do it.
Just a little thought: The dining philosophers problem is used to demonstrate concurrency, but the point about our Resource-Manager is sequential programs getting compressed for parallel execution. So the difference is: The concurrent tasks try to acquire and release resources, whereas the sequential tasks only start, if everything is ready.
But you could create a thread per philosopher, which pushes the tasks (think, eat) to one global queue.
This is not really an issue, but more of an idea to discuss. Is it worth making an example that implements the dining phisolophers problem ?
I think that could be done rather easily with resource hierarchy approach: create n resources (forks), n resource users (philosophers) are indexed, so essentially the same function is called n times.