Provide some real-live examples of Livelock

Technology CommunityCategory: ConcurrencyProvide some real-live examples of Livelock
VietMX Staff asked 3 years ago
  • A real-world example of livelock occurs when two people meet in a narrow corridor, and each tries to be polite by moving aside to let the other pass, but they end up swaying from side to side without making any progress because they both repeatedly move the same way at the same time.
  • Example of livelock will happen where a husband and wife are trying to eat soup, but only have one spoon between them. Each spouse is too polite, and will pass the spoon if the other has not yet eaten.
  • Deadlock detection may cause livelock. If two threads detect a deadlock, and try to “step aside” for each other, without care they will end up being stuck in a loop always “stepping aside” and never managing to move forwards.