3

I am using Java on a UAV project, and have been told that it is often not used when designing military UAVs due to safety concerns. Why is this? I know it has something to do with the fact that it generates it's own code, but can anyone with knowledge of UAVs go into a little more detail about this?

Aero
  • 61
  • 4
  • Just curiosity: which JVM are you using? – Pablo Lozano Mar 04 '14 at 10:20
  • You should ask the one that told you "Java is unsafe for UAVs" in the first place. If he says so he better has a good reasoning behind it or he's just talking nonsense. – hcpl Mar 04 '14 at 10:20
  • Sorry Pablo, what is JVM? I am using Netbeans 7.3, although the question is more for general information than specific to my project. – Aero Mar 04 '14 at 10:24
  • Unfortunately hcpl, I am unable to do this. The question came up at an interview, to which I didn't know the answer, so I am looking for more information about it for next time. – Aero Mar 04 '14 at 10:25
  • Thank you Stewart, very helpful. I am a novice when it comes to computer programming, and am trying to develop my skills – Aero Mar 04 '14 at 10:28
  • 4
    JVM: Java Virtual Machine. The standard one (from Oracle) is not a real-time system. The GC freezes the execution to free memory, so for a while the system is not responsive to any event. – Pablo Lozano Mar 04 '14 at 10:28
  • 2
    speculation: java is several layers removed from the cpu. When controlling fast flying (or driving) things, you want as little latency as possible + Java is not real time. Another thing: java / javabytecode is rather generic code, in security relevant environment it may be an requirement that the code is proof able, that this exact code on this exact cpu type does not cause any glitches – cypherabe Mar 04 '14 at 10:30

3 Answers3

5

It is inherently inconsistent for speed.

As it uses it's own garbage collector it is inevitable that when GC kicks in the rest of the system must slow down a little to accommodate it. Because of that you cannot guarantee the timeliness of your code.

Don't get me wrong - this is not a critique of Java - I am just saying that in Java you cannot guarantee that a certain piece of code will always run within a certain amount of time.

OldCurmudgeon
  • 64,482
  • 16
  • 119
  • 213
  • 2
    +1, any latency at all on an 'unmanned' vehicle means the potential for crashing expensive equipment into things. 99% of the time, you wont have any latency at all, but if the GC runs in a crucial moment you will end up with a pile of wreckage. – Rudi Kershaw Mar 04 '14 at 10:28
2

The short answer is "Java is not real-time"

(Unless you're using real-time Java of course)

Martin Wilson
  • 3,386
  • 1
  • 24
  • 29
1

It seems Java is a valid language for this kind of systems, but it's not trendy enough. Look at this answer from a aeronautics engineer, I think it just what you need to know: you need a JVM with real-time specs.

I don't think the way the bytecode is generated is a security problem: any language you use will be compiled and optimized, and surely the JIT feature (optimization in run-time) could be disabled if it would be an issue

Community
  • 1
  • 1
Pablo Lozano
  • 10,122
  • 2
  • 38
  • 59
  • These are all very useful answers, and have shown me the real-time aspect that I had not previously considered, but is anyone able to shed a little light on the self-generating code aspect of the question too? – Aero Mar 04 '14 at 10:48
  • Updated: I cannot see how the code generation could be a problem. – Pablo Lozano Mar 04 '14 at 10:53