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 priority problem.

Discussion in 'Embedded' started by leilei, Aug 11, 2008.

  1. leilei

    leilei Guest

    Hi.
    I have three task: task1,task2,task3.There priority is 14, 15, 16,
    task1's priority(14) is highest.These task is scheduled through
    priority policy, that is task1 always run first.
    These three task will access a memory buffer- Buffer1.Before they
    write to or read from the memory buffer, they must try to obtain a
    binary sempahore.
    Now I have a trouble, task1 runs too fast, which cause other
    task(task2, task3)can never access the memory buffer.

    How can I solve this problem?I want these three task can run when they
    need to .
     
    leilei, Aug 11, 2008
    #1
    1. Advertisements

  2. leilei

    Jack Guest

    change priority, or put a sleep() on task1, so the other two have time to
    access buffer1. or change the priority policy. or...

    Bye Jack
     
    Jack, Aug 11, 2008
    #2
    1. Advertisements

  3. To be quite honest I'm not sure where to start with this. How have
    you determined the priority of each process? What is each process
    doing? How do the three processes interact?

    Is task1 creating data that is consumed by the other two processes
    or is the relationship more complex than that? We need more details.

    However you resolve this you are going to effectively reduce the
    priority of task1, but depending on this situation a straightforward
    priority reduction in the scheduler may or may not be the best way
    of resolving things. You may be better off putting task1 to sleep
    when it has produced or consumed more data than the other processes
    can handle, but on the information you have supplied it is impossible
    to say.
     
    Andrew Smallshaw, Aug 11, 2008
    #3
  4. leilei

    FreeRTOS.org Guest

    Is the high priority task always able to run - in other words does it ever
    block, delay or sleep? If not then as it is the highest priority task it
    will always be the task chosen to execute and hence the other two tasks will
    be starved of processing time.

    --
    Regards,
    Richard.

    + http://www.FreeRTOS.org & http://www.FreeRTOS.org/shop
    17 official architecture ports, more than 6000 downloads per month.

    + http://www.SafeRTOS.com
    Certified by TÜV as meeting the requirements for safety related systems.
     
    FreeRTOS.org, Aug 11, 2008
    #4
  5. leilei

    CBFalconer Guest

    If they are priority encoded, and task1 never puts itself to sleep
    for lack of work, you don't have enough computer to keep up with
    the tasks. It's not a case of running too fast, rather it is too
    slow. Alternatively the priority scheduler is fouled.
     
    CBFalconer, Aug 11, 2008
    #5
  6. That conclusion doesn't necessarily hold. Different scheduling
    algorithms have different interpretations of "priority". If the
    algorithm you have "always" runs the the highest-priority task "first",
    yes, that can mean it never runs any other task.

    So don't do that, then.
    How do you know that? And how fast is "too fast", anyway?
    Then you'll have to re-think your choice of scheduling strategy and
    priority assignment. As-is, your actions appear to conflict with your
    goals. One of them has to change.
     
    Hans-Bernhard Bröker, Aug 11, 2008
    #6
  7. Well ... perhaps he could get himself one of those new
    multi-core processors with at least three cores. ;)


    --
    Michael N. Moran (h) 770 516 7918
    5009 Old Field Ct. (c) 678 521 5460
    Kennesaw, GA, USA 30144 http://mnmoran.org

    "So often times it happens, that we live our lives in chains
    and we never even know we have the key."
    "Already Gone" by Jack Tempchin (recorded by The Eagles)

    The Beatles were wrong: 1 & 1 & 1 is 1
     
    Michael N. Moran, Aug 12, 2008
    #7
  8. leilei

    CBFalconer Guest

    Kindly refrain from sending email copies of newsgroup articles.
     
    CBFalconer, Aug 12, 2008
    #8
    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.