Professional Documents
Culture Documents
M2: Memory Management: Binding of Instructions and Data To Memory
M2: Memory Management: Binding of Instructions and Data To Memory
Address binding of instructions and data to memory addresses can happen at three different stages.
1. Compile Time
2. Load Time
3. Execution Time
Memory Allocation
The main memory must accommodate both the operating system and the various user processes.
We need to allocate different parts of the main memory in the most efficient way possible.
The main memory is usually divided into two partitions: one for the resident operating system, and
one for the user processes. We may place the operating system in either low memory or high
memory. The major factor affecting this decision is the location of the interrupt vector. Since the
interrupt vector is often in low memory, programmers usually place the operating system in low
memory as well.
There are following two ways to allocate memory for user processes:
Paging
Main memory is divided into a number of equal-size blocks, are called frames. Each process is
divided into a number of equal-size block of the same length as frames, are called Pages. A process
is loaded by loading all of its pages into available frames (may not be contiguous).
https://ue.instructure.com/courses/25074/pages/m2-memory-management?module_item_id=739213 2/3
3/24/22, 9:06 AM M2: Memory Management: NCP_2208 : Operating Systems Lecture
Every address generated by the CPU is divided into two parts: a page number (p) and a page
offset (d). The page number is used as an index into a page table.
The page table contains the base address of each page in physical memory. This base address is
combined with the page offset to define the physical memory address that is sent to the memory
unit.
If the size of logical-address space is 2m and a page size is 2n addressing units (bytes or words),
then the high-order (m – n) bits of a logical address designate the page number and the n low-
order bits designate the page offset. Thus, the logical address is as follows:
https://ue.instructure.com/courses/25074/pages/m2-memory-management?module_item_id=739213 3/3