Task priority problem.

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 .

Reply to
leilei
Loading thread data ...

leilei wrote in news:d3d94642-0f2a-4978-ae2e- snipped-for-privacy@v39g2000pro.googlegroups.com:

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

--
Eroi non si nasce, ti incastrano
- Jim Belushi
Reply to
Jack

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
andrews@sdf.lonestar.org
Reply to
Andrew Smallshaw

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.
Reply to
FreeRTOS.org

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.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.
Reply to
CBFalconer

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.

Reply to
Hans-Bernhard Bröker

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
Reply to
Michael N. Moran

Kindly refrain from sending email copies of newsgroup articles.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.
Reply to
CBFalconer

Perhaps make the tasks run when they need to?

It sounds like you're either letting task1 free-run (which means that you're letting it run when it _doesn't_ need to), and you need to make it trigger off of whatever makes it need to run (timer? external event?).

Or task1 is not keeping up with whatever it is supposed to do, which means that you need more processing power.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
Reply to
Tim Wescott

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.