Here's a patch that fixes RW semaphores on the i386 architecture. It is very simple in the way it works. The lock counter is dealt with as two semi-independent words: the LSW is the number of active (granted) locks, and the MSW, if negated, is the number of active writers (0 or 1) plus the number of waiting lockers of any type. The fast paths are either two or three instructions long. This algorithm should also be totally fair! Contentious lockers get put on the back of the wait queue, and a waker function wakes them starting at the front, but only wakes either one writer or the first consecutive bundle of readers. The disadvantage is that the maximum number of active locks is 65535, and the maximum number of waiting locks is 32766 (this can be extended to 65534 by not relying on the S flag). I've included a revised testing module (rwsem.c) that allows read locks to be obtained as well as write locks and a revised driver program (driver.c) that can use rwsem.c. Try the following tests: driver -200 & driver 200 # fork 200 writers and then 200 readers driver 200 & driver -200 # fork 200 readers and then 200 writers David Howells