Académique Documents
Professionnel Documents
Culture Documents
Memory management
Contents
Deadlock - Bankers Algorithm
Memory management - history
Segmentation
Paging and implementation
Page table
Segmentation with paging
Virtual memory concept
Paging on demand
Page replacement
Algorithm LRU and its approximation
Process memory allocation, problem of thrashing
Example:
The banker knows that all 4 clients need 22 units together, but he has
only total 10 units
Multiple instances.
Resource-
Corresponding
Allocation
wait-for graph
Graph
Sequence <P0, P2, P3, P1, P4> will result in Finish[i] = true
for all i.
Overlay Overlay
1 2
Segment table ST
Function from 2-D (segment, offset) into 1-D (address)
One item in segment table:
base location of segment in physical memory, limit length of
segment
Segment-table base register (STBR) where is ST in
memory
Segment-table length register (STLR) ST size
AE3B33OSS Lecture 5 / Page 26 2012
Hardware support for segmentation
Segment table
limit base
CPU
s o
base
o
limit
< + +
Segmentation fault
Memory
memory
Segments has different size
Memory fragmentation 29
Segemnt moving has big overhead (is not used)
Physical addresses
. 9 j 12
. 1 Frame 10 k
. numbers 11 l 0 5
4
3 12 m 1 6
0 13 n 16
7 2 1
Page 0 1 14 o
Page 3 2
15 p
table 2
Logical Page 20 a
Page 2 3 b
memory table c
Page 1 4 d
5 24 e
f
6 g
h
Page 3 7 28
8
Physical
memory Physical
memory
Logical
address
CPU p d
Page Frame
No. No.
Page found
in TLB
(TLB hit)
TLB f d
Physical
address
p
Physical
memory
Page
table
(PT)
= 20 ns = 60 % EAT = 160 ns
Hierarchical PT
Translation is used by PT hierarchy
Usually 32-bits logical address has 2 level PT
PT 0 contains reference to PT 1
,Real page table PT 1 can be paged need not to be in memory
Hash PT
Address p is used by hash function hash(p)
Inverted PT
One PT for all process
Items depend on physical memory size
Hash function has address p and process pid hash(pid, p)
...
1
Two-level paging structure
...
500
...
100
...
100
...
500
......
...
708
...
708
...
931
0
PT
...
900
...
900
Pages 931
containing
...
PTs
Phys.
1
PT memory
p1 p2 d
Logical physical address
translation scheme p1
p2
Paging implementations
Demand Paging (Demand Segmentation)
Lazy method, do nothing in advance
Paging at process creation
Program is inserted into memory during process start-up
Pre-paging
Load page into memory that will be probably used
Swap pre-fetch
With page fault load neighborhood pages
Pre-cleaning
Dirty pages are stored into disk
Questions?