Re: Lockdep and rw_semaphores

From: David Howells
Date: Tue Sep 13 2011 - 10:07:35 EST



Al is correct.

The in-kernel R/W semaphore implementation is written to be strictly fair. If
the semaphore is readlocked and a writer is pending, all further readers and
writers get added to the back of the FIFO queue, thus preventing writers from
being starved.

When it comes time to wake someone up, the waiter at the front of the queue is
woken. If that's a reader, then next on the queue may be woken up too if
that's also a reader - up to the point a writer is encountered. Any readers
beyond that writer in the queue have to wait for the writer in front of them
to get its share first.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/