EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: epicsThreadSleep() and epicsThreadSleepQuantum()
From: Andrew Johnson <[email protected]>
To: [email protected]
Date: Mon, 29 Sep 2008 18:05:32 -0500
On Monday 29 September 2008 14:57:02 Mark Rivers wrote:
>
> I've just discovered a problem relating to epicsThreadSleep() and
> epicsThreadSleepQuantum() on linux-x86 and win32-x86.

> This is rather important, because I know there are EPICS applications
> that assume that epicsThreadSleepQuantum is truly the minimum time it
> makes sense to request a sleep interval for.  This is clearly not the
> case on Windows and Linux, so perhaps epicsThreadSleepQuantum needs to
> be rewritten for those platforms.

We have a program in base that measures the sleep quantum, it's built as 
libCom/test/O.<arch>/epicsThreadPerform[.exe] but because it mostly does 
performance measurement rather than functional testing it's not run as one of 
the regular libCom/test programs.

The problem is that I can run the exact same test binary on two different 
linux-x86 systems and get wildly different results.  On our 8-core box 
running Fedora Core 6 the quantum is measured at 0.002968 sec whereas on my 
single-core Fedora Core 8 system the result is 0.000026 sec.  I'm guessing 
that the difference is that FC-8 provides CLOCK_REALTIME_HR (which we now use 
if it's available) whereas FC-6 doesn't, but I haven't looked at whether 
that's true or not.

In both the above cases the epicsThreadSleepQuantum() call returns 0.010000 
sec.  The implementations of that routine on all our OSs just ask the OS for 
the system clock tick rate and return 1/that because this used to be a 
reasonable estimate of the sleep quantum, but now it obviously doesn't work 
too well.  Unfortunately we have no way of knowing what the real granularity 
of the nanosleep() routine is on posix unless we measure it, and I'm not sure 
that we want to do that every time an IOC starts up.

If anyone has any better ideas I'm open to them (working code particularly 
welcomed), but this issue is not going to be solved in R3.14.10.

- Andrew
-- 
Talk is cheap. Show me the code. -- Linus Torvalds

Replies:
Re: epicsThreadSleep() and epicsThreadSleepQuantum() J. Lewis Muir
References:
epicsThreadSleep() and epicsThreadSleepQuantum() Mark Rivers

Navigate by Date:
Prev: RE: epicsThreadSleep() and epicsThreadSleepQuantum() Jeff Hill
Next: An error when building EPICS base R3.14.9 on Solaris 8 Evgeniy Tikhomolov
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: epicsThreadSleep() and epicsThreadSleepQuantum() Jeff Hill
Next: Re: epicsThreadSleep() and epicsThreadSleepQuantum() J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·