CITS2002 Systems Programming  
prev
next CITS2002 CITS2002 schedule  

What is portability?

A program may be considered portable if it can be 'moved', migrated, to different computing environments.

These environments do not just include different operating systems, running on different forms of hardware, but can include different (human) interfaces and natural languages.

Many (most?) operating systems are written in C and are, in theory, portable. This is possible because C toolchains (the pre-processor, compiler, and linker) are supported by header files and libraries that have 'extended' the language, without requiring the language, itself, to be changed.

(the above paragraph is not strictly correct, as C11 has recently added new features aiding portability, such as in-language support for Unicode).

 

C is portable at the level of its source-code

C programs require compiling in their new computing environment, or cross-compiled on an existing environment with knowledge of the destination hardware architecture and able to provide the necessary libraries. Examples include being able to develop programs on an Intel-based Linux platform, destined for an ARM-based Raspberry Pi platform (also running Linux), or developing a program under Apple's macOS destined for an iPhone (and then both uploaded (by network or cable) to the new environment).

C's source-level portability is in contrast to:

  • Java's use of an architecture-independent bytecode. Java's source code is compiled on one platform, and the resulting bytecode copied to a destination platform with a platform-specific implementation of a Java Virtual Machine (JVM) to interpret the bytecode.

  • Python's portability coming from its interpretation of its source code with a platform-specific Python interpreter.

 


CITS2002 Systems Programming, Lecture 22, p2, 16th October 2023.