<<On Wed, 29 Mar 2000 19:25:29 -0800, Alfred Perlstein <[EMAIL PROTECTED]> said:

> What do you guys think about that?  Am I totally missing something
> that makes the Linux way right/ok? (no locking on a 64bit struct)

Generally, it's better to design an optimistic or non-blocking
algorithm rather than twisting data structures to fit some
pre-conceived machine model just to allow atomic updates.  Most
architectures provide either an atomic compare-exchange instruction,
or a ``load linked'' instruction, which is what you need in order to
make this work.

For example, there are good non-blocking algorithms for maintaining a
queue given either LL or compare-exchange of 2*sizeof(pointer).
Unfortunately, this requires strict queue semantics, which few parts
of FreeBSD are designed to make use of.  I've had as a background task
for a while now the creation of a non-blocking equivalent to queue(3),
with as much functionality as is possible to achieve while still
maintaining the non-blocking behavior.

(If you were ever wondering why it was that struct socket and struct
inpcb had grown version numbers: it is for similar reasons.  If I were
only smart enough to figure out how, I would have made all socket and
pcb accesses non-blocking.)

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
[EMAIL PROTECTED]  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to