What happens if two process in different processors try to acquire the lock at EXACTLY same time

前端 未结 5 1245
忘掉有多难
忘掉有多难 2020-12-13 02:48

Ok, so I am reading about synchronization, and I read through various algorithms such as spinlocks, semaphores, and mutex to avoid race condition.

However, these alg

5条回答
  •  情书的邮戳
    2020-12-13 03:36

    This is a classical deadlock problem. I'm not sure about hardware support, (but I'm almost sure this is supported at hardware level) however, I can give you an example about the solution for the deadlock problem in databases. If you know all the dependencies you know which dependency should be "killed", this way the commands of the given node will fail, but the system will defeat deadlock and the other nodes won't fail. I think the same approach should be at hardware level.

提交回复
热议问题