Re: [question] Linux read/write spinlocks and readers starving a writer

From: Ben LaHaise (bcrl@redhat.com)
Date: Mon Jun 26 2000 - 11:45:30 EST


On Mon, 26 Jun 2000, Tigran Aivazian wrote:

> I know that Linux read-write semaphores implementation is quite clever
> with respect to putting the new readers to queue behind the waiting
> writer. Now, is something similar true for read-write spinlocks also?

Not at present. Right now what happens for the contended lock case is
that the writer will release its bias of the lock and wait for the lock to
be released by all readers before attempting to reaquire the lock. Is
this the right thing to do? I'm not certain.

Of course, this could be changed as follows: the writer could check if
it's the first writer in line and then keep its write bias on the lock
until the readers go away (like the semaphore variant does). I'll code up
such a patch for evaluation.

                -ben

-
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/



This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 21:00:09 EST