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

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. 

主站蜘蛛池模板: 徐州市| 浦北县| 南通市| 海门市| 昌黎县| 加查县| 金溪县| 芜湖县| 固安县| 新蔡县| 岢岚县| 韶关市| 苗栗市| 利川市| 邢台市| 子洲县| 宿松县| 工布江达县| 永定县| 大安市| 句容市| 武定县| 磐安县| 若尔盖县| 隆昌县| 安丘市| 西乌珠穆沁旗| 玉龙| 孟连| 苍溪县| 固始县| 临朐县| 盐边县| 陆河县| 化隆| 吉首市| 都兰县| 武安市| 临清市| 日土县| 子洲县|