devstat overhead VS precision

Konstantin Belousov kostikbel at gmail.com
Mon Apr 15 19:39:17 UTC 2013


On Mon, Apr 15, 2013 at 09:37:30PM +0200, Pawel Jakub Dawidek wrote:
> On Mon, Apr 15, 2013 at 10:18:15PM +0300, Konstantin Belousov wrote:
> > On Mon, Apr 15, 2013 at 08:42:03PM +0200, Pawel Jakub Dawidek wrote:
> > > On a mostly unrelated note when two threads (T0 and T1) call get*time()
> > > on two different cores, but T0 does that a bit earlier is it possible
> > > that T0 can get later time than T1?
> > 
> > Define earlier first.
> > 
> > If you have taken sufficient measures to prevent preemption and interruption,
> > e.g. by entering spinlock before the fragment that calls get*, then no,
> > it is impossible, at least not with any x86 timekeeping hardware we use.
> > 
> > On the other hand, if interrupts are allowed, all bets are off.
> 
> So if we consider only one thread, it is not possible for it to obtain
> time t0, be scheduled to different CPU and obtain t1 where t1 < t0?

Yes, I believe this scenario is also not possible. The context switching
ensures that thread's view on the global memory is consistent. At least
it is so on x86, and I think it must be the same on all other architectures.
Otherwise the compiler emited code would not work.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-geom/attachments/20130415/128c1b4c/attachment.sig>


More information about the freebsd-geom mailing list