Subject: Re: SMP & ntpd interaction?
To: None <email@example.com>
From: David Laight <firstname.lastname@example.org>
Date: 01/18/2003 13:08:24
> All cases could be handled by first making a local copy of the time
> value to be modified, update that and store it back into the global
> variable. To do this, we need two operations like: ATOMIC_READTIMEVAL
> and ATOMIC_WRITETIMEVAL.
That will only work if there is only one writer (or any updating
is always done with some lock held).
It will save having to grab the lock to read the time - since the
reader won't (usually) care whether the value obtained is before
or after the update, it just doesn't want a partially updated
Only the alignment of the global data matters, doublework access
to the local data isn't required.
On a related note, all the reference counters on data structures
have to be protected by a lock, ptr->ref++ wont be atomic on
memory. Statistics counters can (probably) be allowed to miscount.
David Laight: email@example.com