Pumpkin, Inc.

Pumpkin User Forums

Is it possible to design preemptive system with salvo?

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

Is it possible to design preemptive system with salvo?

Postby hcotuk » Fri Nov 16, 2007 7:18 am

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,


Legends never die...
Posts: 1
Joined: Wed Oct 31, 2007 11:00 pm
Location: Ankara;N/A,Turkey

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

Postby aek » Fri Nov 16, 2007 8:47 am

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.


Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 1 guest