timer in emmeded linux

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi all,

I need to set timer in C/linux like alram, such that i will get a
timeout signal after specific timeout and my process remain executing
as is it.
I can use signal(SIGALRM, xyz) and then alarm(some value in sec), there
is a constraint in this as i can pass timeout only in seconds and i
need in milli sec.
Any idea how todo this.

Regards,
Paresh


Re: timer in emmeded linux
Quoted text here. Click to load it

Pure Linux is not a real _hard_ time system. So _exact_ msec timers
can't be done. You might see a delay of several 100 msec (though only
very seldom).

If your need is only _soft_ realtime I suppose there are lots of ways to
use timers in Kernel and in user mode.

-Michael

Re: timer in emmeded linux
Quoted text here. Click to load it

What's your hardware?  There are free-running timers available on some
platforms - maybe all platforms.  But again, they're not super-accurate.

It's easy enough to launch a watchdog thread to watch the free-running
timer while your other thread is doing something else.

--Yan

Re: timer in emmeded linux
Most linux configured 100 ticks/second. In kernel you get that in term
of 10 milli seconds intervals. If user space, it could be much more
than that.
snipped-for-privacy@gmail.com wrote:
Quoted text here. Click to load it


Re: timer in emmeded linux
Quoted text here. Click to load it

Not really true. With Kernel 2.6 on PC you have a default of 1 mSec
ticks in the Kernel. Other Architectures have 10 mSec or something in
between. You can change this value in a .h file, but the value needs to
be chosen according to the hardware capabilities. In user space, 2.6
always uses 10 mSec ticks. Changing this (in the same .h file) is
discouraged.

But anyway, there is never a guarantee that a tick is really executed
timely. You can loose some, even in the Kernel.

-Michael

Site Timeline