Home arrow Support arrow Forums

Luminary Micro Forums

<< Start < Prev 1 2 3 Next > End >>

rocksoft

Expert Boarder
Click here to see the profile of this user

2008/08/08 04:21

Re:add user interrupts on future device

> ...the difference between an RTOS and a non-RTOS begins to blur. Both are good - it depends on your application

Very true indeed! One has to ask the question how real time does the application need to be.

With an instruction cycle of 20ns and the very good NVIC it can be quite hard to justify the need for a pre-emptive RTOS for small applications.

To complicate the argument further a combination of pre-emption and function scheduling can have benefits. This can be a good way of separating background tasks that don't care about latency from the things that do care.

login or register to reply

dereksoftstuff

Expert Boarder
Click here to see the profile of this user

2008/08/09 03:24

Re:add user interrupts on future device

With an event driven system, you could process the event in the ISR, instead of setting a flag and polling later in the thread. This seems like a great idea at first sight, because you get zero latency between interrupt and 'task' execution, and the NVIC does all the pre-emptive scheduling for you, based on the priorities of the interrupts. Unfortunately the downside is that the ISRs take a lot longer to execute, and hence block other lower priority interrupts (i.e. tasks). This could be a problem if your system has to respond to several different interrupts at high frequencies.

Comparing RTOS to non-RTOS systems :-
Ignoring scheduling and overheads for now.

Terminology -
Event (E) = interrupt, exception, trigger, stimulus
Action (A) = task, process, module, function, code block
Time (T) = time duration of Action (continuous)

Lets have a system with 10 Events E1 .. E10
E1 is highest priority, E10 lowest.

example1:
E1 .. E5 all occur approx same time.

Delay Time(D) before actioning E5 =
D:RTOS = T1 + T2 + T3 + T4
D:non-RTOS = x + T1 + T2 + T3 + T4
where x is time for current action to complete

For a balanced system T1 = T2 ... = T10 = 1ms

D:RTOS = 4ms
D:non-RTOS = 4-5ms

For a unbalanced system T1 = T2 ... = T7 = 1ms
T8 = T9 = T10 = 5ms

D:RTOS = 4ms
D:non-RTOS = 4-9ms

So which is real-time?

The RTOS may be able to smooth out the bumps in unbalanced systems, otherwise a simple non-RTOS probably out-performs the overheads/complexity of an RTOS.

What's the difference between a 'background' task and any other 'task'? Priority?, Time? ...

login or register to reply
<< Start < Prev 1 2 3 Next > End >>