What's the difference between deadlock and livelock?

后端 未结 7 1702
渐次进展
渐次进展 2021-01-29 17:20

Can somebody please explain with examples (of code) what is the difference between deadlock and livelock?

7条回答
  •  梦毁少年i
    2021-01-29 17:44

    DEADLOCK Deadlock is a condition in which a task waits indefinitely for conditions that can never be satisfied - task claims exclusive control over shared resources - task holds resources while waiting for other resources to be released - tasks cannot be forced to relinguish resources - a circular waiting condition exists

    LIVELOCK Livelock conditions can arise when two or more tasks depend on and use the some resource causing a circular dependency condition where those tasks continue running forever, thus blocking all lower priority level tasks from running (these lower priority tasks experience a condition called starvation)

提交回复
热议问题