Page 1 of 1

Is it possible to design preemptive system with salvo?

PostPosted: Fri Nov 16, 2007 7:18 am
by hcotuk
Hi all,

I'm wondering why it is not possible to call OS_xxx user services from ISR? If it were possible, we could return to scheduler in planned time intervals from ISR and that means it is not necessary to call OS_Yield or similar commands within tasks to return to scheduler. So without explicitly calling services within tasks, from ISR we can return to scheduler and switch into other task immediately.

If it is about saving context, what is the limitation? What can I do for calling services from ISR? Could you please explain a bit more or give some hints?

I know salvo is designed for cooperative scheduling but i am wondering why preemptive scheduling is not considered?

If i want to work on this issue, could you please give me some hints?

Thanks and regards,


Re: Is it possible to design preemptive system with salvo?

PostPosted: Fri Nov 16, 2007 8:47 am
by aek
Most services can be called from ISRs ... generally speaking, only OS_WaitXyz() cannot. That's not unusual among RTOS (preemptive or cooperative).

I think the bigger issue is why do you think you need preemptive scheduling for this particular application? Have you actually run a serious application using Salvo? What part of its responsiveness was inadequate for your application? A well-written Salvo application differs mainly from a comparable preemptive application only in that the places where task switching occur are explicit in Salvo (OS_Xyz()), whereas they can occur almost anywhere in a preemptive system. As long as your Salvo tasks are relatively short, you'll have excellent responsiveness.

Plus Salvo has other benefits, including no hooks to interrupt services, zero interrupt latency on many ports, total control of when context switching occurs, etc.

Preemptive systems are different, to be sure, but it's a rare day when I see an application that truly requires preemptive multitasking. In many cases, Salvo can do the job, with a smaller footprint (esp. RAM-wise), more simply, and with less chance of programming error.

As to the gist of your question, you asked in the PICmicro forum. The PIC architecture (esp. PIC16) is completely unsuited to preemptive RTOSes due to the lack of an accessible software stack.

There are lots of preemptive RTOSes. You're welcome to delve deeper into them. When I wrote Salvo I saw no point in creating another. I wanted to create something that had the advantages of multitasking without the disadvantages (mainly RAM requirements, but there are performance issues as well) of preemptive systems.