POSIX timers running on VxSIM are not accurate - VxWorks

This is a discussion on POSIX timers running on VxSIM are not accurate - VxWorks ; I want to use the POSIX timers for one of the porting project. I am building trial application on VxSIM (Tornado 2.0.2 & Vxworks 5.4) I have attached the signal handler which prints on console. This signal handler process SIGALRM ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: POSIX timers running on VxSIM are not accurate

  1. POSIX timers running on VxSIM are not accurate

    I want to use the POSIX timers for one of the porting project. I am
    building trial application on VxSIM (Tornado 2.0.2 & Vxworks 5.4)
    I have attached the signal handler which prints on console. This signal
    handler process SIGALRM type of signal.
    But using this timer, I am not getting exact timeout. eg. If I set
    ptrNewTimeSpecs->it_interval.tv_nsec = 0;
    ptrNewTimeSpecs->it_interval.tv_sec = 40;
    ptrNewTimeSpecs->it_value.tv_nsec = 0;
    ptrNewTimeSpecs->it_value.tv_sec = 40;
    I get timeout of 53 seconds approximately. I tried to set different
    timeouts, but every time the actual time I got is more than expected
    one.
    Also, Please explain the role of tick rates int the timers.


  2. Re: POSIX timers running on VxSIM are not accurate


    > I want to use the POSIX timers for one of the porting project. I am
    > building trial application on VxSIM (Tornado 2.0.2 & Vxworks 5.4)
    > I have attached the signal handler which prints on console. This
    > signal
    > handler process SIGALRM type of signal.
    > But using this timer, I am not getting exact timeout. eg. If I set
    > ptrNewTimeSpecs->it_interval.tv_nsec = 0;
    > ptrNewTimeSpecs->it_interval.tv_sec = 40;
    > ptrNewTimeSpecs->it_value.tv_nsec = 0;
    > ptrNewTimeSpecs->it_value.tv_sec = 40;
    > I get timeout of 53 seconds approximately. I tried to set different
    > timeouts, but every time the actual time I got is more than expected
    > one.
    > Also, Please explain the role of tick rates int the timers.


    Hi,

    If you have read the nice manual, you should know that in VxSim you are
    running all VxWorks tasks in a single (host) proces. Thus the complete
    VxWorks environment (kernel+tasks+interrupts) get the same amout of
    timeslices as any other proces/application on your system, like your e-
    mail program or your webbrowser.

    VxSim is far for accurate, nor is it realtime, it isn't even
    close to it.

    Please answer this question, if you host operatingsystem is not
    realtime, how can a single proces of that operating systemen be
    realtime? If you host operating system swaps-out memory to disk, and
    holds all tasks, how can you OS be realtime.

    VxSim is a nice tool to test code, to see if algorithms work (or not).
    Please dont do any estimations on timing or execution time, there might
    a hi bias on it.

    Cheers,
    Renee.

    --


  3. Re: POSIX timers running on VxSIM are not accurate

    Thanx Renee,
    I got the point. But is it guranted that it will work accurate on the
    actual real time system?
    (Right now, I am not ready with hardware to test on)
    Also, On one of group's discussion, I read the following:

    "The VxWorks watchdog (wdLib) is a software mechanism for many
    software modules to share a single hardware timer, that is
    the system clock. Each wdLib client can request a timeout
    which is a multiple of the system clock tick, and a user defined
    function (aka callback) is executed within interrupt service routine
    of the system clock interrupt.


    Being run at ISR, the wdLib delivery callback is very accurate,
    as it is not subject to task priority, but the code therein should
    be kept as short as possibly, and comply with the limitations
    of an ISR, i.e. call only those system functions which are
    allowed for ISR, and avoid using floating point arithmetics.


    The POSIX timer is an entirely different software mechanism,
    which uses the same system clock as its time reference, but
    uses the POSIX signal mechanism (versus callback) to deliver
    the timer alert to the requesting task, as a result, the signal
    function which is executed as a result of the timer expiration
    runs within the context of the task that requested the timer
    originally.


    The signal delivery mechanism will be invoked effectively when
    the receiving task is scheduled, which is subject to that task's
    priority, so the delivery will be less accurate, and suffer greater
    delay, but is not limitted with respect to the length or complexity
    of code that can be executed therein. It will only effect the task
    which is associated with that timer. "

    So keeping above in mind, can we assure the system will produce
    accuratre timings when running on actaul target boards??

    Regards,
    Ritesh


  4. Re: POSIX timers running on VxSIM are not accurate

    That discussion summarizes it nicely, but keep in mind that eventually
    the posix mechanism eventually call the regular wdLib functions for
    software timers, so you still have the same underlying accuracy of the
    system tick to deal with - ie don't specify a 125nS timer and complain
    when it comes back one tick later.

    The issue of dealing with the delivery of a task-based mechanism to
    deliver timer notifications is not an issue of the timer itself, but of
    the nature of other parameters in the system - ie task priorities,
    rates of interrupts, use of task locking mechanisms, etc.

    You could certainly use a hardware timer and put all your application
    code in the ISR, but you'd still have other ISR to deal with contending
    for CPU time. You can't blame the RTOS then for not having accurate
    timers

    lc

    ritesh.kondekar@gmail.com wrote:
    > Thanx Renee,
    > I got the point. But is it guranted that it will work accurate on the
    > actual real time system?
    > (Right now, I am not ready with hardware to test on)
    > Also, On one of group's discussion, I read the following:
    >
    > "The VxWorks watchdog (wdLib) is a software mechanism for many
    > software modules to share a single hardware timer, that is
    > the system clock. Each wdLib client can request a timeout
    > which is a multiple of the system clock tick, and a user defined
    > function (aka callback) is executed within interrupt service routine
    > of the system clock interrupt.
    >
    >
    > Being run at ISR, the wdLib delivery callback is very accurate,
    > as it is not subject to task priority, but the code therein should
    > be kept as short as possibly, and comply with the limitations
    > of an ISR, i.e. call only those system functions which are
    > allowed for ISR, and avoid using floating point arithmetics.
    >
    >
    > The POSIX timer is an entirely different software mechanism,
    > which uses the same system clock as its time reference, but
    > uses the POSIX signal mechanism (versus callback) to deliver
    > the timer alert to the requesting task, as a result, the signal
    > function which is executed as a result of the timer expiration
    > runs within the context of the task that requested the timer
    > originally.
    >
    >
    > The signal delivery mechanism will be invoked effectively when
    > the receiving task is scheduled, which is subject to that task's
    > priority, so the delivery will be less accurate, and suffer greater
    > delay, but is not limitted with respect to the length or complexity
    > of code that can be executed therein. It will only effect the task
    > which is associated with that timer. "
    >
    > So keeping above in mind, can we assure the system will produce
    > accuratre timings when running on actaul target boards??
    >
    > Regards,
    > Ritesh



+ Reply to Thread