Certainly. I agree with your demonstration. As you comment, the theory
doesn't matter (much) without the specifics of the implementation.
There are just *two* semaphores in use in the main kernel, uts_sem and
the mmap_sem. I think it reasonable to assume, therefore, that when
someone writes:
lock();
schedule();
unlock();
that they are probably referring to spin_lock() and its cousins.
Certainly, if you use down() and up() then you get the behaviour I
described regarding condition_wait() and condition_signal(), which, if
course, are semaphores also.
Since the kernel code uses spin_lock() widely, which doesn't have the
properties that down() and up() have, your example doesn't apply to
the kind of deadlocks Richard was referring to.
--p
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/