Here is an x86 implementation of down_read_trylock() and down_write_trylock() for read/write semaphores. As with down_trylock() for exclusive semaphores, they don't block if they fail to get the lock. They just return 1, as opposed to 0 in the success case. The algorithm should be robust. It should be able to handle any race and clean up properly if a task fails to get the lock, but I would appreciate comments if anyone sees a flaw. Admittedly, the code path for successfully grabbing the lock is longer than it should be. I should have done the nested if tests in down_*_trylock() with js and jc assembly instructions, rather than using sets and setc to copy the flags to C variables. My excuse is that I'm unfamiliar with assembly programming, so I took the path of least resistance. I've only tested the code to make sure it compiles and works properly when the lock is already held, but there are no waiters. This is the tricky case where it has to weasel out of holding the bias. The success case and non-bias failure case still need to be tested. Stress testing might also be a good idea. I don't have the time to do this right now, but I thought I'd make the patch available in case anyone else is interested the functionality. Brian Watson Compaq Computer brian.j.watson@compaq.com