Thursday, August 30, 2012
Raspberry PI - Suitable for Real Time?
I used to to a lot of true "real time" programming, in Assembler and FOTRAN on PDP-11's, then 6800/6809's and more recently on the PIC in "C" ("WalkMorse" project - not yet published).
"Real-time programs must guarantee response within strict time constraints ... a non-real-time system is one that cannot guarantee a response time in any situation, even if a fast response is the usual result."
This site states
"Note that this module (class to control the GPIO) is unsuitable for real-time or timing critical applications. This is because you can not predict when Python will be busy garbage collecting. It also runs under the Linux kernel which is not suitable for real time applications - it is multitasking O/S and another process may be given priority over the CPU, causing jitter in your program."
So the bottom line is, if you are controlling something that is VERY critical as to timing, the rPI with Raspbian + Python is not the ticket. I would have to do some testing, but IMHO I am sure you would get guaranteed 1 second response at least (maybe with some jitter), probably down to 100 ms (maybe less) without too much issue.
However if you want real guaranteed response, you would need to use a suitable chip such as PIC, ARM, etc. programmed in assembler or C on the bare metal, or a true Real Time OS.
There seems to be some buzz about putting a real time OS on the rPI, but I am not aware of any yet.
Eric Pierce VA3EP - See the Disclaimer in the Introduction
© Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", 1952-2099. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Eric Pierce and "VA3EP Amateur Radio And Other Geek Pursuits", with appropriate and specific direction to the original content.