Hi --
--- In David Hawkins <> wrote:
>
> Yan Seiner wrote:
> > Has anyone come up with a way to sleep less than 10 msec with
the
> > standard 2.4 kernel?
> >
> > both usleep and select sleep a min. of 10 msec. Any portable
way to
> > do so?
> >
> > I would guess going to the 1000 Hz kernel clock would work but
I'm a
> > bit leery of screwing up stability....
Also the processor load goes up a lot ...
>
> Have you tried nanosleep, or select() with a < 10ms timeout?
>
> If neither method works, then I think you have to
> resort to a custom driver. The TS-7300 FPGA, or an
> EP9301 timer (if there is a spare one) can be setup to
> generate your delay, and select() can unblock the
> file descriptor.
>
> However, even in that case, you may get stuck with the
> scheduler scheduling your process in the next 10ms
> time-slice.
Yes, I think that's the issue you would run into. But my man page
for nanosleep also mentions the old (2.4) behavior:
Old behaviour
In order to support applications requiring much more precise
pauses (e.g., in order to control some time-critical hardware),
nanosleep() would handle pauses of up to 2 ms by busy waiting with
microsecond precision when called from a process scheduled under a
real-time policy like SCHED_FIFO or SCHED_RR. This special
extension was removed in kernel 2.5.39, hence is still present in
current 2.4 kernels, but not in 2.6 kernels.
So this extension may work for your 2.4 kernel, if you fiddle with
your process priority, and if it was implemented for ARM. Your
sleep duration would be more accurate, but still scheduled in 10 mS
slices.
>
> The 2.6 kernel uses a pre-emptive approach, so its
> more responsive.
The High Resolution Timer patches work great, and the -rt patch is
available too. In fact, this 10 mS granularity was recently
discussed at length on LAKML:
http://marc.info/?t=118711874700004&r=1&w=2
>
> I've sent you some timer tests I ran a while back on a
> 2.4 kernel.
>
> Cheers,
> Dave
>
Using the test code posted in the above thread, and calling
nanosleep with 1000 nS delay (TS-7250):
192:~# cat /proc/version
Linux version 2.6.22.4-rt9 (gcc version 4.1.1
(CodeSourcery ARM Sourcery G++ 2006q3-26)) #5 PREEMPT RT Fri Aug 24
20:42:52 EDT 2007
192:~# ./test_rt2
loop time: min = 0.000016, max = 0.000197
The 16 uS is always the same for me, the max ranges from 165 to 203
uS. I'd be happy to test some other code on 2.6 if it would help,
but it sounds like you want to stick to 2.4 kernels.
Regards, ......... Charlie
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|