History
In early computers, code was position-dependent: each program was built to be loaded into, and run from, a particular address. In order to run multiple jobs using separate programs at the same time, an operator had to carefully schedule the jobs so that no two simultaneous jobs would run programs that required the same load addresses. For example, if both the payroll program and the accounts receivable program were built to run at address 32K, the operator could not run both at the same time. Sometimes, an operator would keep multiple versions of a program around, each built for a different load address, to expand his options.
To make things more flexible, position-independent code was invented. Position-independent code could run from any address at which the operator chose to load it.
The invention of dynamic address translation (the function provided by an MMU) almost made position-independent code obsolete because every process could have its own separate 32-bit (or even more) address space. Because position-independent code is less efficient than position-dependent code, this was a better solution to the problem.
The next problem to be attacked was the memory waste that happens when the same code is loaded multiple times to be used by multiple simultaneous jobs. If two jobs run entirely identical programs, dynamic address translation provides a solution by allowing the system simply to map two different jobs' address 32K to the same bytes of real memory, containing the single copy of the program.
But more often, the programs are different and merely share a lot of common code. For example, the payroll program and the accounts receivable program probably both contain an identical sort subroutine. So designers invented shared modules (a shared library is a form of shared module). While the main payroll and accounts receivable programs get loaded into separate memory, the shared module gets loaded once and simply mapped into the two address spaces.
Position-independent code has been used not only to coordinate the work of user-level applications, but within operating systems as well. The earliest paging systems did not use virtual memory address spaces; instead, the operating system would explicitly load individual modules of itself as needed, overwriting less needed ones (the memory available for the operating system was much smaller than the operating system). A module had to be capable of running in whatever memory was free at the time it was needed, so individual operating system modules were made of position-independent code.
The invention of virtual memory made that method obsolete, because the operating system could have a virtual address space so big that every module of the operating system could have its own permanent virtual address.
Read more about this topic: Position-independent Code
Famous quotes containing the word history:
“Hence poetry is something more philosophic and of graver import than history, since its statements are rather of the nature of universals, whereas those of history are singulars.”
—Aristotle (384322 B.C.)
“A people without history
Is not redeemed from time, for history is a pattern
Of timeless moments.”
—T.S. (Thomas Stearns)
“A great proportion of the inhabitants of the Cape are always thus abroad about their teaming on some ocean highway or other, and the history of one of their ordinary trips would cast the Argonautic expedition into the shade.”
—Henry David Thoreau (18171862)