A legacy embedded system is implemented using a cooperative multi-tasking scheduler.
The system essentially works along the following lines:
- Task A does work
- When Task A is done, it yields the processor.
- Task B gets the processor and does work.
- Task B yields
… - Task n yields
- Task A gets scheduled and does work
One big Circular Queue: A -> B -> C -> … -> n -> A
We are porting the system to a new platform and want to minimize system redesign.
Is there a way to implement that type of cooperative multi-tasking in vxWorks?
While VxWorks is a priority based OS, it is possible to implement this type of cooperative multi-tasking.
Simply put all the tasks at the same priority.
In your code, where you do your yield, simply insert a ‘taskDelay(0);’
Note that you have to make sure the kernel time slicing is disabled (kernelTimeSlice(0)).
All tasks at the same priority are in a Queue. When a task yields, it gets put at the end of the queue. This would implement the type of algorithm described.