Question

How does the linux kernel avoids deadlocks in user processes? Does it have a built-in mechanism that prevents them, or one that recognizes and kills them?

And, is there anything similar for kernel programming?

Was it helpful?

Solution

The kernel does not avoid deadlocks of user-space locks (because often it doesn't even know about them).

Deadlocks of kernel locks are avoided by writing code that is correct. This is greatly helped by lockdep, which can prove the correctness of locking operations.

(The lockdep code has been ported to user space, but it helps only for programs that bother to use it.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top