I am looking at the linux version for a Rover using a Pi model B. Do I actually need RTOS? I am not looking to start a long debate between rtos and schedulers. I can compile the patches in. I am just wondering if the software is dependent upon RTOS. I have some margin of error being on the ground and all. Plus it will move at maybe 5mph so not extremely fast.
Nothing is stopping you from using the real time functions in the kernel to remove unix scheduling, i.e. using the kernel for drivers only. Change the scheduling to realtime by priority, and then set priorities of your tasks based on your criteria. You now have a rtos that will schedule tasks to run by priority, non real time tasks will run using unix scheduling on the remaining cpu ticks. Using signals, I measured (using logic analyzer and toggling gpio pins) the context switch on a RPI 1 at around 10.0 - 15.0 usec. With signals and events, setting the kernel tick to 1000 Hz, gives a 1 msec scheduler with about 1% overhead. This is also the way if works in real world avionics. Richard Stevens is one of the unix Gods, and like K&R his books have detailed examples. There are several good books on Linux/Unix Real Time programming. I would also suggest learning the value of shared memory and it’s proper use, i.e. using client/server read/write protocols, the need for semaphores is eliminated!