Was working on a python related to avionics, came across a serious doubt whether code written in python would compile or run on a real time OS used in on board systems.
-
2Related: Why is Python used on aircraft although it may not be certifiable? – Jun 18 '19 at 11:44
-
1From a software certification viewpoint, you are going to have a much more difficult time certifying Python software in a safety critical application. Even C++ can require more work than C or Ada. The related question @ymb1 shared has some very useful information. – selectstriker2 Jun 18 '19 at 13:31
-
See https://stackoverflow.com/questions/7079864/real-time-operating-via-python/24819846 – Juan Jimenez Jun 18 '19 at 13:38
-
1It also does not help that Python cannot be compiled to machine code. Many people talk about Python compilers but they are all interpreters. Use the right tool for the job. – Juan Jimenez Jun 18 '19 at 13:49
-
You can compile Python as an executable @JuanJimenez, but that defeats the purpose IMO. Python is great but I wouldn't stake my life on it! Give me Ada. – GdD Jun 18 '19 at 13:52
-
@GdD If you are talking about PyInstaller, that is not a compiler, it's a resource bundler. The result is still interpreted, just easier to distribute. Same with py2exe. – Juan Jimenez Jun 18 '19 at 14:00
-
A non-trivial RTOS can run lower-priority tasks that don't have to be real time; certainly there are ways to run python or at least microphython in such a setting if there's a sound reason to. Modern aircraft have dozens if not hundreds of distinct systems segregated for distinct purposes (likely including level of auditing necessary), not all of them remotely real time. – Chris Stratton Jun 18 '19 at 14:09
-
1Good point @JuanJimenez. – GdD Jun 18 '19 at 14:13
-
The other point to consider is that not everything on an aircraft runs on an RTOS. Some entertainment systems even run WindowsCE. Of course, no one appeared to have considered the effect of a BSOD on the average garden variety houseplant-level passenger. :) – Juan Jimenez Jun 18 '19 at 14:18
-
Many military jets (and other systems) still rely on ADA for a programming language, and for good reason. ADA, despite being very old, is an extremely powerful language and has built-in protections. – Ron Beyer Jun 18 '19 at 15:16
-
You need a real time program. Python (current implementation) cannot offer such guarantee. You may need to check old discussion about Linux Kernel for real time: hits: doesn't depend on speed, in fact real time is often slower, but guaranteed. – Giacomo Catenazzi Jun 19 '19 at 14:07
1 Answers
Language like Python, Java or C# require complex execution environment to run. This environment consists of tens and hundreds of thousands lines of code. It would be a huge work to review and certify it all, so certifying a Python application is not about reviewing ten lines of code that implement the needed algorithm.
While there are also various libraries for C or C++ as well, they are all optional. There is much more built-in stuff in high level languages, starting from the memory garbage collector that alone may be enough to make the implementation too complex to deal with.
Also, high level languages tend to have slightly unpredictable execution speed with short arbitrary pauses (they are not real time). This also limits where they could be used.
- 12,100
- 6
- 49
- 93