Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jan 2001 11:14:49 -0500 (EST)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        current@FreeBSD.ORG
Subject:   Re: Atomic breakage?
Message-ID:  <200101171614.LAA18224@khavrinen.lcs.mit.edu>
In-Reply-To: <20010116191009.E7240@fw.wintelcom.net>
References:  <3A64AA23.30035A1C@elischer.org> <Pine.BSF.4.21.0101171400210.3074-100000@besplex.bde.org> <20010116191009.E7240@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Tue, 16 Jan 2001 19:10:10 -0800, Alfred Perlstein <bright@wintelcom.net> said:

> Just wondering, can't you use 'LOCK addl' and then use 'LOCK addc'?
> add longword, add longword with carry?  I know it would be pretty
> ugly, but it should work, no?

The two bus cycles are independent, so there is a race condition.

OTOH, it's a fairly *unlikely* race condition, and the worst thing
that can happen is statistics that are obviously off by four billion.
(The race only occurs when there is a carry out of the low-order
longword, which is to say, once in every 2**32 operations.)

-GAWollman



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101171614.LAA18224>