1
1
Storage Allocation
Operating System Hebrew University Spring 2007
2
Background
- Program must be brought into memory and
placed within a process for it to be run.
- Input queue – collection of processes on the
disk that are waiting to be brought into memory to run the program.
- User programs go through several steps before
being run.
3
Binding of Instructions and Data to Memory
- Address binding of instructions and data to
memory addresses can happen at three different stages:
– Compile time – Load time – Execution time
4
Binding of Instructions and Data to Memory
- Compile time: If memory location known in advance,
absolute code can be generated;
- Must recompile code if starting location changes.
- Load time: Must generate relocatable code if memory
location is not known at compile time.
- Execution time: Binding delayed until run time if the
process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers).
5
Multi-step Processing of a User Program
6
Division of Responsibility
- Compiler: generates one object file for each source code
file containing information for that file. Information is incomplete, since each source file generally uses some things defined in other source files.
- Linker/Loader: combines all of the object files for one
program into a single object file, which is complete and self-sufficient.
- Operating system: loads object files into memory,
allows several different processes to share memory at
- nce, provides facilities for processes to get more
memory after they have started running.
- Run-time library: provides dynamic allocation routines,