|
Hi, I am a novice in programming on RTOS.
I have a question about the task function design. For example, the system tick is 10ms,
if one task can't finish a loop within 10 ms (do one function in one loop), then how can I guanrantee the funciton's run time?
I mean, the time it start, and the time it stop?
|
|
|
|
|
Your question is pretty valgue as there are a lot of RTOS's out there. A guess, is to put the function in its own thread and make the thread a higher priority than all others so it would not be preempted. Prioritization can be a tricky business though.
|
|
|
|
|
Not being sarcastic, but check out this article on Wikipedia: http://en.wikipedia.org/wiki/Real-time_operating_system[^]
HOW the RTOS you are using schedules threads is very important. Many (most?) RTOSs can't actually guarantee a function's run time; they simply run fast enough that with proper programming you can get close enough. Something that takes over 10ms will almost always fall into this latter category since writing a function to use such an exact amount of time is essentially impossible (hardware interrupts alone on embedded system will add enough variance to cause a measurable difference in timings.)
(Here's a good article on RTOS interrupt scheduling: http://rtos.com/articles/18835[^])
modified 7-Jan-13 16:37pm.
|
|
|
|