Messages in this thread | | | Date | Mon, 9 Aug 2004 21:36:55 -0400 (EDT) | From | Rik van Riel <> | Subject | Re: 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 you?
> 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |