Difference between racearound condition and deadlock

前端 未结 5 1927
遇见更好的自我
遇见更好的自我 2020-12-07 10:24

What is the difference between a dead lock and a race around condition in programming terms?

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 10:52

    Deadlock :

    1. This happens when 2 or more threads are waiting on each other to release the resource for infinite amount of time.
    2. In this the threads are in blocked state and not executing.

    Race/Race Condition:

    1. This happens when 2 or more threads run in parallel but end up giving a result which is wrong and not equivalent if all the operations are done in sequential order.
    2. Here all the threads run and execute there operations.

    In Coding we need to avoid both race and deadlock condition.

提交回复
热议问题