Re: Upgradeable read locks for USB (was: Re: Kernel locks)

Matthias Urlichs (smurf@work.smurf.noris.de)
12 Jan 1998 23:37:31 +0100


Linus Torvalds <torvalds@transmeta.com> writes:
>
> So do people think that the reader-prefering version would be better?

There are two answers to this question. ;-)

(A) Create an #ifdef switch to select between a prefer-readers and a
prefer-writers version of the lock. Do a few parallel whatevers on
an SMP machine. Check which is faster. Use that.

That being said, personally I'd prefer readers, because (a) not every
update lock actually does an update and (b) the updater might walk through
a data structure more slowly than a reader, and it therefore seems silly to
punish readers if they might be able to zip through and release their lock
before the updater actually needs to do the write part of its access.

For instance, finding a routing table entry (in order to update it) is more
work than routing itself because you need to match against more fields.

-- 
Matthias Urlichs
noris network GmbH