1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Task running Time

Discussion in 'Embedded' started by sai.e, Jul 13, 2006.

  1. sai.e

    sai.e Guest

    Hi all,

    I have a problem with tasks switching

    for example I have created three tasks in priority based pre-emption
    the highest priority task will run when it goes to suspended state or
    when it compleates scheduling switches to the next high priority task,
    but i want that the running task to be suspended and scheduling
    switches to the next high priority ready task after some defined time
    let us say 100ms. Then next task is to run for some time let us say
    50ms then it has to give scheduling to the next ready high priority

    summary of problem

    In Priority based Pre-emption

    1st high priority ready task runs for 100ms then it suspends
    2nd high priority ready task runs for 50ms then it suspends
    3rd high priority ready task runs for 200ms then it suspends

    this above senario has to be continue for ever

    please give me some suggestions how to implement this.

    NOTE: I am using VxWorks RTOS

    sai.e, Jul 13, 2006
    1. Advertisements

  2. sai.e

    Noway2 Guest

    Does VxWorks support dynamic task priority assignments?

    You could use a timer interrupt, which would have a higer priority than
    the tasks and then elevate the priority of the one that you want to

    You could also probably work something out with a task sleep function.

    owever, what you are trying to do, though, sounds like you are
    defeating part of the purpose of the RTOS and attempting to use a
    round-robin like scheduler instead. There are problems associated with
    this type of scheduling which is why one uses a pre-emptive priority
    based scheduler in the first place.

    If you approach the code from a different perspective you can probably
    achieve better performance. Try to find ways to use the various
    priority levels available to you to your advantage as opposed to making
    everything equal and time slicing it.
    Noway2, Jul 13, 2006
    1. Advertisements

  3. sai.e

    Pete Fenelon Guest

    When I was working on automotive RTOSes we found that a lot of OEMs
    had to include an RTOS (typically an OSEK) in their systems to get
    through the manufacturers' door with their products, but the mix of
    inertia, NIH syndrome, and unfamiliarity with RTOS concepts meant that
    they were still designing cyclic schedulers, complete with all manner of
    gruesome major/minor cycles in them.

    Pete Fenelon, Jul 13, 2006
  4. It appears that there is a bad problem in the application design,
    especially in the division of labour between the tasks.

    Many people faced with a priority based pre-emptive system for the
    first time, usually try to boost the priority of the task that they
    think is the most critical. However, increasing the priority for an
    individual task does not solve anything (unless hardware processing
    power is added).

    Instead of trying to boost the priority of some critical task, I have
    used for decades the principle of trying to identify the operations
    that could be moved to a _lower_ priority task, without risking the
    required functionality. I usually end up with 5-10 tasks, in which the
    highest priority tasks do not do much more than an interrupt service
    routine and most of the time consuming hard work is done in the low
    priority tasks.

    The question of RTOS task switching times is mostly academic, since it
    applies to the highest priority task latencies. For the next highest
    priority task, you would have to calculate the OS latency and the
    worst case latency caused by the highest priority task and so on.
    Thus, it is important to be able to determine the worst case execution
    time of any high priority task.

    Paul Keinanen, Jul 13, 2006
  5. sai.e

    Dave Guest

    The NG comp.os.vxworks would be an appropriate place to ask this.

    Dave, Jul 13, 2006
  6. sai.e

    Noway2 Guest

    The project we are developing now, is using TI's DSP/BIOS for an RTOS.
    It seems to be a fairly standard pre-emptive scheduler. I decided to
    use it more for the experience of doing so than anything else. The
    project is simple enough that it could have been done without it, but I
    wanted to try it as I had never included one before.

    I understand what you are saying about, 'needing to include them to
    get in the door'. I think there is a common misconception that says
    that something created by someone else is automatically better than
    anything (your own) people can do. Then I knew people who swore by
    using an RTOS for everything just because they believed it was the only
    correct way to do things as it was naturally superior. The most
    reliable projects that I ever worked on, though, still used a couple of
    state machine driven while(1) {} loops.
    Noway2, Jul 14, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.