5/9 Weeks of Photography

5/9 Weeks of Photography

My photo for the 5th week is delayed! So I'm dedicating the fifth photo to one of the causes of delays here in the city: bad traffic conditions. It's not inherently obvious in the picture, but it's supposedly demonstrating a deadlock, where the vehicles can't pass since they're all blocking each other.

Interestingly, there was a bill proposed in Kansas related to this:

When two trains approach each other at a crossing, both shall  come to a full stop and neither shall start up again until the other has  gone.

Deadlocks also happen with computer processes. The conditions for a deadlock are:

  1. Mutual Exclusion - one resource refuses is non-shareable,
  2. Hold and wait - a process is holding one resource and is waiting for more,
  3. No Preemption - resource can only be voluntarily released by the process holding it,
  4. Circular Wait - Resource 1 is waiting on Resource 2, Resource 2 is waiting on Resource 3, ..., Resource N-1 is waiting on Resource N, Resource N is waiting on Resource 1.
Source: https://en.wikipedia.org/wiki/Deadlock#/media/File:Process_deadlock.svg

One way to solve deadlocks is using the Ostrich algorithm, that is, stick your head in the sand and ignore the problem. Some other methods used are process termination or reallocating resources until the deadlock no longer occurs.