Simple Memory Model Typical Example Memory Map (One Process' Virtual Address Space
Address Data
Each location has an address
and stores some data
.
00 12
m n
As
↓
01 34 Fixed
Locala bles
size ;
Code Executable binary Read only
Here 02 00
we've
got 8-bit addresses Stack
(and data 03 FF
W W
Read-only Fixed size;
data
strings tables,
,
...
Of 48 i wo Read only
Allocated
05 65
Fixedsiza
&
I ↑ at run-time Static data Global variables ,
Of 6C
hexadecimal Dynamic
space
07 6C
Local Dynamici
Heap (possibly Stack variables
6 Read/write
08 F
fragmented)
09 00
Dynamic
* Heap Run time structures
!
&
OA
Read/write
A5
Global Data Read/write
- -
Read
Constants
only
.. --
Reserved by computer
-- ...
8-bitWestata
FE DE
Code Read only
↑ &
↓
281 D
FF AD
OS
.
Restricted !
.
private
space
Processes Memory Management Sizes
Processes use an idealised set of virtual addresses
Processor architecture determines the size (#of locations) of the virtual
address space
OS Momony
These then mapped to
are
physical addresses
Management
Process * locations
Processes don't have to worry about where they are
**
Usually are 8-bit (bytes)
Software
in memory
MMU
Storage ,
0 1 1 101 O 1
Cache,
Memory RAM
Management
Unit
16-bit > 65356 addresses
32-bit > 4294967294 addresses
64-bit > 18446744073709551616 addresses
Mapping Virtual Addresses to Physical Addresses : Simple Approach Variable Partition
1280
, 000
OS OS OS OS
Operating Process 5 Process 5 Process 5 ??? p
System
D · Process 8 * Process 8 Process
a
896000 # base + limit Process 7
??? A
256000 Process 2
Process 2 Process 2 Process 2 Process 2
base
Process 2 64000 &
O Process 2
Virtual addresses Strategies
38400
First-fit :
Stop when you
find a hole big
Process 3
enough
base and limit registers 128000
base "Start" of physical Best-fit : Find the smallest hole big
:
O
enough
memory
limit : Size of range Worstfit Find : the largest hole