Let's say that, instead philosophers, we have TCP/IP connections to a server, and instead forks we have the server's TCP/IP avaliable ports. In this scenario, we don't have a lot of connections competing for the ports: we have a few number of malicious connections that will take a lot of time to process, so they will take the awaliable ports and release them after a long time (from some minutes to several hours). In this scenario, actual non-attacking connections will "starve".

In this case, the analogy would be:

  • avaliable ports: forks
  • non attacking connections: philosophers that spend more time thinking than eating
  • attacking or malicious connections: philosophers that spend a lot more time eating than thinking.

If we ignore the case when every philosopher takes one fork (they deadlock eachother), I consider Dining-Philosophers an example for resource starvation, because if there are no avaliable shared resources, the threads will wait (maybe forever) until a resource is released by another thread.


The more I think about this analogy the less sense it makes.

  • Ports don't work as a resource here. A server will have only a handful of ports open, perhaps only one (say, port 80 for HTTP). Any number of clients can connect to this and their connections are differentiated by the client port ID (and client IP), which are independent for each client. Port numbers aren't the limited resource that's attacked by DoS attacks, network bandwidth or CPU time or similar things are.
  • Although network bandwidth and CPU time are, in the end, an integer amount (in the appropriate unit), it is not meaningful to identify these units with forks. Clock cycles or bandwidth is interchangeable, while forks have identity, and the analogy becomes absurd when each philosopher needs 5 million forks. Furthermore, now a philosopher can take, say, one clock cycle and hold onto it for a minute, which is at least more abstract and makes philosopher-time meaningless.
  • The philosophers have spatial arrangement and choose from the forks around them. In contrast, any reasonable notion of resource in your analogy will not be constrained like this: Any client can get any resource, probably at the discretion of the server rather than by choice of the client.
  • As you note, there is no potential for deadlocks. The dining philosophers is more about deadlocks (and livelocks) than starvation, though I'm certain some discussion of fairness can be found. Resource starvation is typically discussed with other examples.
  • 2
    A better analogy is to imagine your server as a physical store with each port being a door. A DDoS is like having 100,000 robots walk into the store, pick up some random item on the shelf, put it back, and then walk back out again without making a purchase. – Steven Burnap Mar 31 '15 at 19:59
  • I can see it better now: a DDoS attack would be like a philosopher that comes first to the dinner, tooks all the forks, and eats all the food before the rest of the philosophers can arrive. – Broken_Window Apr 1 '15 at 3:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.