Previous | Next --- Slide 11 of 62
Back to Lecture Thumbnails
darthryking

So if we apply the four ingredients of deadlock here, how would we do that? I guess this highly depends on what "resources" each party is acquiring and waiting for. At a quick first attempt, the resources involved in the left image would be the bird's throat, and... the frog itself? It seems?

Anyway, here's my stab at it:

  1. Mutual Exclusion: Clearly the frog holds the bird's throat, although one might argue that the throat is the bird's since it's... part of the bird. From a deadlock perspective, I suppose that here, only the frog truly has control over the throat resource. Where this gets interesting is whether the frog owns itself (since it IS itself), or the bird has control of the frog's body "resource" by nature of the frog being inside the bird's mouth. I'd think the latter, since that makes this deadlock ingredient work.

  2. Hold and Wait: Frog is holding the bird's throat, and it's waiting for the bird to release its body so it can use its body to continue doing frog stuff. Bird is holding the frog's body, and it's waiting for the frog to release its throat in order to swallow it.

  3. No Preemption: Nobody can force either of them to give up the resource that they currently hold, and indeed neither party is going to willingly do it on their own. (My money's on the frog having the upper hand here though, since the bird has more incentive to release the frog than the frog does to release the throat! ;)

  4. Circular Wait: The bird needs both its throat and the frog's body to do its task of eating the frog. The frog needs its body to do frog stuff, but it doesn't seem to inherently need the bird's throat to do frog stuff though. (I guess "survival" counts as "frog stuff"? That seems to be the only way to make this work...)

A quick attempt at building the dependency graph: we can start with the frog, who holds the throat, which is waited on by the bird, which holds the frog's body, which is waited on by the frog. This creates a cycle.