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

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. 

主站蜘蛛池模板: 屯留县| 广丰县| 义乌市| 高唐县| 黑河市| 尚义县| 昆明市| 丁青县| 郧西县| 东丽区| 陕西省| 高州市| 连山| 广丰县| 浠水县| 府谷县| 肇源县| 郧西县| 祁连县| 镶黄旗| 闸北区| 龙江县| 三明市| 定西市| 南投县| 阜新| 含山县| 韶山市| 井冈山市| 融水| 嘉禾县| 黄平县| 长宁县| 龙泉市| 翁牛特旗| 临西县| 贵州省| 泸溪县| 新干县| 邢台县| 观塘区|