by October 12, 2002 0 comments

What makes all the mind-boggling happenings we’ve been talking about in the previous pages possible is chunks of code (software) that works under the hood of war machinery. Besides software being embedded in defense machinery–missile control, radars, surveillance etc–there are also programs for training, simulation and planning. 

In the former case, the programs can be hard wired or burned into the device circuit (called firmware) and reside on a non-volatile memory (ROM). Or, the program can be loaded into a volatile memory (like RAM) from a secondary storage device like a hard disk. 

In the case of training, planning and simulation, the programs usually run on workstation/server machines. They may run across a network so that multiple participants, sitting at their console, can work on the training and planning. Such programs usually have an intuitive graphical display, like a 3-dimensional display.

The programs that run on military hardware like this SGI TP 9100 Server should have error-free and precise code to avoid accidents and loss of lives 

So, what’s special about coding programs for defense as opposed to that for civil? The approach largely remains the same, but the considerations change. The essential considerations while coding for a defense project are performance, precision and error-free (note that we are saying not low on errors, but free from errors). While one can manage a word-processor crashing, but the failure of an aircraft system can cost lives. 

Here’s a look at the features expected in a programming language that can be used for defense projects. 

Hardware access
Most software in defense (leaving aside the training and simulation programs) would be control software to control the hardware machinery. Hence, the language or its libraries should have routines (functions/methods) to send inputs to and receive outputs from the hardware through I/O ports (for example serial, parallel). The language should be able to manipulate the data at the bit level. 

High performance
In defense systems, time is critical, hence processing should be fast. A missile-tracking system should be fast enough to calculate and predict the co-ordinates of a missile flying at several hundred kilometers per hour. 

For higher performance, besides employing powerful processors, the program code itself should be optimized for extra gains in performance. There must be powerful, optimizing compilers available for the language that can optimize and translate the source code into native hardware instructions. To speed up critical code blocks, the language should support the facility to embed low-level instructions within the code.

Parallel processing
A missile system may need to track missiles, predict the missile course, destroy an attacking missile and look up the maps to calculate the missile co-ordinates. At some point it may have to carry out more than one of these tasks at the same time.

About ADA

ADA, unlike C (which was developed as a general-purpose high-level language) was designed from ground-up for defense projects. In 1975 a program called DoD High Level Commonality was started in by the US defense. The goal was to find among the existing languages, or develop a single language suitable for all the real-time embedded defense projects. Four DoD contractors worked towards this. After the evaluation of the proposed designs, ADA made its debut. ADA, similar to C, has traits of Pascal programming language. ADA was made the mandatory development language for all the defense projects.

However, though developed as a programming language for defense, ADA is being used for civil projects also. 

Hence, to develop such a system, the programming language must provide routines to parallelize the code. The processes may run on one processor/machine (multithreading) or may spawn across multiple machines (clustering). Hence, there must be libraries for both multithreading as well as message passing (for clusters) available for the language. For more on clustering and multithreading see How Multi-processing Works, page 40, May 2002 issue of

Priority queues
Sometimes, it’s essential to carry out one task before the other. A task for defense should be carried out first, before offense. For example, it’s more important to intercept and destroy an attacking missile than to launch a missile to attack. Hence, the software system should be able to decide which task (from amongst a list of assigned ones) has higher priority. In software, such a concept is implemented as a queue–a data structure. A priority queue is one in which the tasks are arranged based on their priority. A least priority task is kept at the rear of the queue and the highest priority task is kept at the front. Tasks are worked upon from the front of the queue. 

Error handling
While it may not be possible to develop a 100% error-free program, it is surely possible to develop a program that can handle likely and unlikely errors. Hence, the programming language used for defense applications must have methods to trap the errors and perform counter measures to recover from it. For example, on detecting a failure in one the components of the hardware, the software must switch over to another redundant component. 

Precision and accuracy
Most processes in the defense area require precise mathematical calculations to arrive at the output. Precision and accuracy of calculations is a must in defense programs. The language must have data structures to hold large integers and floating-point numbers. Especially when calculations involve decimal or floating-point numbers the decimal places must be preserved for accurate results 

The languages used
C/C++ and ADA seem to be the languages used for most defense software projects. While ADA is mostly used in the US (see box), C/C++ seems to be the language of choice for defense projects in our country. These two languages are used because their performance and hardware access capabilities are superior to most other languages. Good optimizing compilers for both languages are available for a variety of hardware platforms. 

However, this does not leave out other languages from being used in defense. Pascal, Fortran, Visual Basic, Java, etc, are being used wherever suited for a defense project. Defense projects, which are outsourced without any strict development constraints, may be developed in any language by the third-party company. Training and simulation programs are often coded using 3D graphics libraries like OpenGL and DirectX. 

The Bottom Line: Programming for defense is programming with accuracy, performance and error handling. The
programmer must adhere to the specifications laid out during the project. 

Shekhar Govindarajan

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.