[lkml]   [2004]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Locking scheme to block less
On Mon, 9 Aug 2004, John Richard Moser wrote:

> Currently, the kernel uses only spin_locks,

Oh ? Haven't you seen the read/write locks in
include/linux/spinlock.h or the lockless synchronisation
provided by include/linux/rcu.h ?

> If the kernel provided a read-write locking semaphore,

Funny, it does. You're not looking at a 2.0 kernel, are

> spin_read_to_write_lock(spin_rwlock_t *lock);

> A read_to_write lock will block two such operations from occuring
> concurrently, while still allowing read only operations AND still being
> blocked when switched to write mode by both read and write operations.

In fact, two threads trying to upgrade their read lock to a
write lock simultaneously will block EACH OTHER, FOREVER.

Sounds like an exceedingly bad idea to me ;)

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:05    [W:0.040 / U:2.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site