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:
“The history of work has been, in part, the history of the workers body. Production depended on what the body could accomplish with strength and skill. Techniques that improve output have been driven by a general desire to decrease the pain of labor as well as by employers intentions to escape dependency upon that knowledge which only the sentient laboring body could provide.”
—Shoshana Zuboff (b. 1951)
“I am not a literary man.... I am a man of science, and I am interested in that branch of Anthropology which deals with the history of human speech.”
—J.A.H. (James Augustus Henry)
“While the Republic has already acquired a history world-wide, America is still unsettled and unexplored. Like the English in New Holland, we live only on the shores of a continent even yet, and hardly know where the rivers come from which float our navy.”
—Henry David Thoreau (18171862)