[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Eliminates drift associated with glibc POSIX.1b timer implementa
Eric F. Sorton
[PATCH] Eliminates drift associated with glibc POSIX.1b timer implementation
Mon, 8 Apr 2002 16:13:05 -0400
Attached is a patch for linuxthreads-2.2.5 which eliminates the drift
associated with the POSIX.1b timer implementation. Initial tests show
promising results. For example, a simple performance test using a 10Hz
interval timer with a fixed number of iterations shows the following:
expected time w/o patch w/ patch
10Hz, 100 iterations 10.00 11.00 10.02
10Hz, 200 iterations 20.00 21.99 20.02
10Hz, 300 iterations 30.00 33.01 30.01
* All times in seconds.
The above tests were run on a PII 350, stock Linux 2.4.18 kernel.
This patch also provides an initial implementation of the timer_getoverrun()
function. The overrun count does work, but it does not conform to the
standard. According to "POSIX.4: Programming for the Real World" by
... the number of timer expirations that have occured between the time
the timer expiration signal was queued to the process, and the time at
which the signal was delivered to the process.
The implementation of timer_getoverrun() provided here returns the number of
timer expirations missed which is determined while scheduling the next firing
of the timer. Although this is non-conforming, it can provide feedback that
all is not well. Based upon the threaded implementation of the timers, this
seems to be an acceptable compromise.
I used the _POSIX_DELAYTIMER_MAX define found in /usr/include/bits/posix1_lim.h
to constrain the largest value returned by timer_getoverrun(). 32 is the
minimum value allowed by the spec; Gallmeister recommends using a larger value
(i.e. MAX_INT - 1). I did not address this issue and accepted the value of 32.
Feel free to drop the overrun support if the non-conforming behavior is an
I may take another stab at the overrun support if I think of a better
implementation, but nothing comes to mind at this time.
+--=--=- Eric F. Sorton <eric at cctcorp dot com> --=--=--=--=--=--=--=-+
| Command and Control Technologies Corporation (http://www.cctcorp.com) |
| Phone: (321) 264-1193 Fax: (321) 383-5096 |
Description: Text document
- [PATCH] Eliminates drift associated with glibc POSIX.1b timer implementation,
Eric F. Sorton <=