Computer memory uses both logical addresses and physical addresses. Address binding allocates a physical memory location to a logical pointer by associating a physical address to a logical address, which is also known as a virtual address. Address binding is part of computer memory management and it is performed by the operating system on behalf of the applications that need access to memory.
Address binding relates to how the code of a program is stored in memory. Programs are written in human-readable text, following a series of rules set up by the structural requirements of the programming language, and using keywords that are interpreted into actions by the computer's Central Processing Unit. The point at which the executable version of a program is created dictates when address binding occurs. Some program languages, such as "C" and COBOL need to be compiled, while others, mainly scripts, run from the original program text rather than a machine code compiled binary version.
The first type of address binding is compile time address binding. This allocates a space in memory to the machine code of a computer when the program is compiled to an executable binary file. The address binding allocates a logical address to the starting point of the segment in memory where the object code is stored. The memory allocation is long term and can be altered only by recompiling the program.
If memory allocation is designated at the time the program is allocated, then no program can ever transfer from one computer to another in its compiled state. This is because the executable code will contain memory allocations that may already be in use by other programs on the new computer. In this instance, the program's logical addresses are not bound to physical addresses until the program is invoked and loaded into memory.
Execution time address binding usually applies only to variables in programs and is the most common form of binding for scripts, which don't get compiled. In this scenario, the program requests memory space for a variable in a program the first time that variable is encountered during the processing of instructions in the script. The memory will allocate space to that variable until the program sequence ends, or unless a specific instruction within the script releases the memory address bound to a variable.