timer in emmeded linux - Embedded

This is a discussion on timer in emmeded linux - Embedded ; 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 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: timer in emmeded linux

  1. timer in emmeded linux

    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


  2. Re: timer in emmeded linux

    > 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 need in milli sec.


    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

  3. Re: timer in emmeded linux

    pareshvarshney@gmail.com wrote:
    > 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
    >


    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

  4. 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.
    pareshvarshney@gmail.com wrote:
    > 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



  5. Re: timer in emmeded linux

    Max wrote:
    > 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.


    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

+ Reply to Thread