官术网_书友最值得收藏!

Livelocks

Livelocks are similar to deadlocks, in the sense that they also happen when the application can't correctly continue its execution. The difference is that during a livelock the state of the application is constantly changing, but the state changes in a way that further prevents the application from resuming normal execution.

Commonly, a livelock is explained by picturing two people, Elijah and Susan, walking in opposite directions in a narrow corridor. Both of them try to avoid the other by moving to one side: Elijah moves to the left while Susan moves to the right, but since they are walking in opposite directions, they are now blocking each other's way. So, now Elijah moves to the right, just at the same time that Susan moves to the left: once again they are unable to continue on their way. They continue moving like this, and thus they continue to block each other:

Flow chart for the example of a livelock

In this example, both Elijah and Susan have an idea of how to recover from a deadlock—each blocking the other—but the timing of their attempts to recover further obstructs their progress.

As expected, livelocks often happen in algorithms designed to recover from a deadlock. By trying to recover from the deadlock, they may in turn create a livelock. 

主站蜘蛛池模板: 大英县| 赤峰市| 蒙自县| 苍梧县| 舞钢市| 汾阳市| 左权县| 环江| 新余市| 大同县| 上思县| 铜川市| 辽阳县| 巴东县| 西乡县| 河南省| 台东县| 瑞金市| 雷山县| 六盘水市| 玛纳斯县| 灵宝市| 牟定县| 宜章县| 沧源| 克什克腾旗| 定边县| 宜川县| 略阳县| 临夏县| 揭东县| 巴东县| 绥化市| 宜兴市| 微博| 子洲县| 封丘县| 宿迁市| 皋兰县| 格尔木市| 加查县|