g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  Index 2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014 
<== Date ==> <== Thread ==>

Subject: EPICS R3.14 "delay scheduling quantum" interface changes
From: Andrew Johnson <anj@aps.anl.gov>
To: EPICS Core-talk Archive <core-talk@aps.anl.gov>
Date: Tue, 18 Mar 2003 13:06:54 -0600
Archving a message from Jeff:

All,

I just spoke with Marty on the phone and I think that we are now
in agreement.

Executive summary:
o The basic interface change proposal is agreed to be valid and
is expected to produce important improvements in the average
timer delay scheduling errors.
o The fundamental building block for these changes is a new
epicsThread.h interface "double epicsThreadSleepQuantum(void)"
returning the shortest slumber that can be obtained with
epicsThreadSleep().
o Certain names in the epicsTimer.h interfaces are too long and
should be reduced to a more compact size.
o Marty will investigate what POSIX says about
sysconf(_SC_CLK_TCK) and whether it can be used safely to
implement epicsThreadSleepQuantum(void) on POSIX systems.
o I will put together a description of the new interfaces for use
in the ADG (see attached).
o Someone needs to decide what impact if any all of this has on
the scheduling of delays in the scan tasks.
o We still need to decide how and when this gets committed to
CVS.

A more detailed description of some of the above issues follows:

The function epicsThreadSleepQuantum() will be implemented
differently on POSIX, RTEMS, vxWorks, and win32. I have finished
the win32 implementation. The vxWorks version will probably be
based on sysClkRateGet(). Marty will investigate to see if there
is an answer to this question (which I raised in a previous
message). Someone (hopefully Eric) will need to investigate the
RTEMS implementation. We need to decide if the various
implementations should be prepared before or after committing the
current state of the interface changes to CVS.

> One problem is that there does not appear to be any guaranteed
> portable functions in POSIX that returns this information? I am

> worried that sysconf(_SC_CLK_TCK) provides the units for the
> times() call, but that there is no guarantee that it is
> equivalent to the kernel scheduling clock interrupt frequency
> used to implement nanosleep() even if that is a quite common
situation. But perhaps this isn't a big problem as there can be
> overrides for any UNIX system where sysconf(_SC_CLK_TCK) does
> not produce the desired result. On vxWorks we can use
> sysClRateGet()? If this information is unavailable for a
> particular OS then there shouldn't be a problem with having
> that OS return zero from epicsThreadSleepQuantum() and we will
> be no worse off than we are today.

In response to our discussions I will make the following name
changes in the epicsTimer.h interfaces in the interest of
brevity.

1) I changed the virtual member function name in class
epicsTimerQueueNotify from "delaySchedulingQuantum" to "quantum".

2) I changed the C typedef name epicsTimerQueueRescheduleCallback
to epicsTimerQueueNotifyReschedule.
I changed the C typedef name
epicsTimerQueueDelaySchedulingQuantumCallback to
epicsTimerQueueNotifyQuantum.
These restructured names will hopefully also better document the
fact that these C callbacks are direct plug-ins for the C++
virtual functions in epicsTimerQueueNotify.

Documentation to be added to the ADG:

Under epicsThread.h (advanced users):

double epicsThreadSleepQuantum ( void );

This function returns the minimum slumber interval obtainable
with epicsThreadSleep() in seconds. On most OS there is a system
scheduler interrupt interval which determines the value of this
parameter. Knowledge of this parameter is used by the various
components of EPICS to improve scheduling of software tasks in
time when the reduction of average time scheduling errors is
important.

If this parameter is unknown or is unpredictable for a particular
OS then it is safe to return zero.

Under epicsTimer.h (advanced users):

class epicsTimerQueueNotify {   // X aCC 655
public:
    virtual void reschedule () = 0;
    virtual double quantum () = 0;
protected:
    virtual ~epicsTimerQueueNotify () = 0;
};

The virtual function epicsTimerQueueNotify::reschedule() is
called when the delay to the next timer to expire on the timer
queue changes.

The virtual function epicsTimerQueueNotify::quantum() returns the
timer expire interval scheduling quantum in seconds. This allows
different types of timer queues to use application specific timer
expire delay scheduling policies. The implementation of
epicsTimerQueueActive employs epicsThreadSleep() for this
purpose, and therefore epicsTimerQueueActive::quantum() returns
the returned value from epicsThreadSleepQuantum(). Other types of
timer queues might choose to schedule timer expiration using
specialized hardware interrupts. In this case
epicsTimerQueueNotify::quantum() might return a value reflecting
the precision of a hardware timer. If unknown, then
epicsTimerQueueNotify::quantum() should return zero.

typedef struct epicsTimerQueuePassiveForC *
epicsTimerQueuePassiveId;
typedef void ( * epicsTimerQueueNotifyReschedule ) ( void *
pPrivate );
typedef double ( * epicsTimerQueueNotifyQuantum ) ( void *
pPrivate );

The typedefs epicsTimerQueueNotifyReschedule and
epicsTimerQueueNotifyQuantum are the "C" interface equivalents to
epicsTimerQueueNotify:: reschedule() and
epicsTimerQueueNotify::quantum() respectively (see xxxx above).

Jeff
__________________________________________________________
Jeffrey O. Hill               Mail         JOHill@lanl.gov
LANL MS H820                  Voice        505 665 1831
Los Alamos NM 87545 USA       Fax          505 665 5107




Navigate by Date:
Prev: Re: -mlongcall test Andrew Johnson
Next: Change-Request: Hostnames used for Channel Access / Access Security Ralph Lange
Index: 2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014 
Navigate by Thread:
Prev: Re: -mlongcall test Andrew Johnson
Next: Change-Request: Hostnames used for Channel Access / Access Security Ralph Lange
Index: 2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·