Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: RE: Time waits for ca-pend-event on Solaris/SPARC
From: "Jeff Hill" <johill@lanl.gov>
To: "'Gary P Carr'" <gcarr@lanl.gov>, <tech-talk@aps.anl.gov>
Date: Thu, 5 Jun 2003 11:47:55 -0600
Gary,

> Does anyone know what the actual timeouts will be for a
> ca_pend_event(timo) call on a Solaris/SPARC machine? I 
> guess the real question is does SPARC normally have a 
> "real" realtime clock, or does it use a line clock with
> 60Hz tics?
> 
> If I call ca_pend_event(0.0001), does it block for at least:
> 
> 1) 0.0001 seconds
> 2) until the next tic
> 3) at least one tic (0.01667 seconds)

Executive summary:

On most operating systems the answer is as follows:
(Solaris appears to use a 10 mS tick)
R3.14: until the next tick
R3.13: the delay you specified plus some fraction of a tick

Detailed answer:

On many operating systems scheduling delays and measured delays are mostly
orthogonal issues. Because of the overhead associated with hardware interrupts
operating systems commonly implement scheduling delays with a periodic system
tick. In contrast measured delays are frequently based on the value of a
hardware counter, and therefore can be much more accurate. Often this is the
same counter which is counting off the next system tick interrupt. For example,
when EPICS R3.14 is running on an Solaris/Sun-blade-1000 epicsThreadSleep() has
a quantum around 10 mS, but if memory serves epicsTime::getCurrent() has a
quantum closer to 5 uS. A contrary example is vxWorks where no one has so far
plumbed in the more accurate generic source for time and therefore
epicsTime::getCurrent() still returns a coarse time based on the system tick
when specialized hardware time sources are unavailable.

You are probably already aware that ca_pend_event() will take care of any
pending background activities that the CA client library might find are needing
attention, and it might take longer than the specified delay to complete these
activities.

Delays specified to ca_pend_event() are implemented with select() in R3.13, and
with epicsThreadSleep() in R3.14. In either case a call to ca_pend_event() with
a delay of 100 uS will result in a operating system scheduled delay. If the
specified delay is less than 1.0 / CLOCKS_PER_SEC then a delay will not be
scheduled with the operating system.

As I recall, on Solaris systems a minimum operating system scheduled delay will
be in the range of 0 through 10 mS depending on how the code happens to be
aligned at some instant in time with the system tick counter. 

In R3.14 the CA client library is thread safe on all supported operating
systems, and so on Solaris you might find it is more convenient to schedule
delays in an independent thread, or to use an epicsTimer.

Jeff



References:
Time waits for ca-pend-event on Solaris/SPARC Gary P Carr

Navigate by Date:
Prev: Re: Linking question Guy Jennings
Next: time init problem Bill Cruise
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Time waits for ca-pend-event on Solaris/SPARC Gary P Carr
Next: time init problem Bill Cruise
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·