Java livelock example


What does the livelock look like in the code ? On the Internet, there are only examples of life where people meet in the corridor.

Author: Павел Squad, 2017-05-09

1 answers

An example would be a simple consensus algorithm. Let's assume that there is some algorithm that agrees on the current value of some register. If a data update message arrives at the time of consensus generation, the algorithm resets and starts over. If such messages come too often, you get the same live lock - the system is constantly working, but can not agree on the value. A simplified example (this is not a consensus algorithm) would be counting all records, managed by the application - if a message arrives at the time of counting that a record has been changed or added, the algorithm must start over. If messages are added too often, the system goes into live lock.

 4
Author: etki, 2017-05-10 10:50:22