Chapter-8(Memory)_Updated
Chapter-8(Memory)_Updated
These slides were compiled from the OSC textbook slides (Silberschatz, Galvin,
and Gagne) and the instructor’s class materials.
To start, consider simple scheme where the value in the relocation register is added to
every address generated by a user process at the time it is sent to memory
Base register now called relocation register
MS-DOS on Intel 80x86 used 4 relocation registers
The user program deals with logical addresses; it never sees the real physical
addresses
Execution-time binding occurs when reference is made to location in memory
Logical vs. Physical
Address Space
Dynamic relocation using a
relocation register
Physical address: The
actual hardware memory
address.
32-bit CPU’s physical
address 0 ~ 232-1
(00000000 – FFFFFFFF)
128MB’s memory
address0 ~ 227-1
(00000000 – 07FFFFFF)
Logical address: Each
(relocatable) program
assumes the starting
location is always 0 and
the memory space is
much larger than actual
memory
CSE323 Memory Management 8
Memory Protection
Relocation register = the value of the smallest physical address
Limit register = the range of logical address space
CSE323 Memory Management 9
Memory Protection
When the CPU scheduler selects a process for
execution, the dispatcher loads the relocation
and limit registers with the correct values as
part of the context switch.
Every address generated by the CPU is
checked against these registers.
OS OS OS OS
process 8 process 10
Block 1 50
Block 2 200
List of Jobs Size Turnaroun Block 3 70
d
Block 4 115
Job 1 100k 3
Job 2 10k 1
Block 5 15
Job 3 35k 2
Job 4 15k 1
Job 5 23k 2
Job 6 6k 1
Job 7 25k 1
Job 8 55k 2
Job 9 88k 3
Job 10 100k 3
contiguous logical-to-
phyiscal space mapping.
CSE323 Memory Management 24
Internal Fragmentation
With the scheme of breaking the physical
memory into fixed-sized blocks, and allocate
memory in unit of block size, results internal
fragmentation.
With this approach, the memory allocated to a
process may be slightly larger than the
requested memory. The difference between
these two number is internal fragmentation.
Data Heap
Stack
Code
Heap Stack
Code
validation bit = 0 illegal segment
read/write/execute privileges
d2
Stack top
used