Hubbry Logo
search
logo
Porting
Porting
current hub

Porting

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Porting

In software development, porting is the process of adapting software to run in a different context. Often it involves modifying source code so that a program can run on a different platform (i.e. on a different CPU or operating system) or in a different environment (i.e. with a different library or framework). It also describes adapting a change or feature from one codebase to another – even between different versions of the same software.

Software is classified as portable if it can be hosted in a different context with no change to the source code. It might be considered portable if the cost of adapting it to a context is significantly less than the cost of writing it from scratch. The lower the cost of porting relative to the cost to re-write, the more portable it is said to be. The effort depends on several factors including the extent to which the original context differs from the new context, the skill of the programmers, and the portability of the codebase.

The term "port" is derived from the Latin portāre, meaning "to carry". When code is not compatible with a particular operating system or architecture, the code must be "carried" to the new system.

The number of significantly different CPUs and operating systems used on the desktop today is much smaller than in the past. The dominance of the x86 architecture means that most desktop software is never ported to a different CPU. In that same market, the choice of operating systems has effectively been reduced to three: Microsoft Windows, macOS, and Linux. However, in the embedded systems and mobile markets, portability remains a significant issue, with the ARM being a widely used alternative.

International standards, such as those promulgated by the ISO, greatly facilitate porting by specifying details of the computing environment in a way that helps reduce differences between different standards-conforming platforms. Writing software that stays within the bounds specified by these standards represents a practical although nontrivial effort. Porting such a program between two standards-compliant platforms (such as POSIX.1) can be just a matter of loading the source code and recompiling it on the new platform, but practitioners often find that various minor corrections are required, due to subtle platform differences. Most standards suffer from "gray areas" where differences in interpretation of standards lead to small variations from platform to platform.

There also exists an ever-increasing number of tools to facilitate porting, such as the GNU Compiler Collection, which provides consistent programming languages on different platforms, and Autotools, which automates the detection of minor variations in the environment and adapts the software accordingly before compilation.

The compilers for some high-level programming languages (e.g. Eiffel, Esterel) gain portability by outputting source code in another high level intermediate language (such as C) for which compilers for many platforms are generally available.

Instead of translating directly into machine code, modern compilers translate to a machine independent intermediate code in order to enhance portability of the compiler and minimize design efforts. The intermediate language defines a virtual machine that can execute all programs written in the intermediate language (a machine is defined by its language and vice versa). The intermediate code instructions are translated into equivalent machine code sequences by a code generator to create executable code. It is also possible to skip the generation of machine code by actually implementing an interpreter or JIT for the virtual machine.

See all
User Avatar
No comments yet.