Title: Classroom slides memory systems
1Classroom slides memory systems
2(No Transcript)
3(No Transcript)
4(No Transcript)
5PCB
- enum state_type new, ready, running,
waiting, halted - typedef struct control_block_type
- enum state_type state
- address PC
- int reg_fileNUMREGS
- struct control_block next_pcb
- int priority
- address memory_footprint ????
- .
- .
- control_block
6(No Transcript)
7PCB
- enum state_type new, ready, running,
waiting, halted - typedef struct control_block_type
- enum state_type state
- address PC
- int reg_fileNUMREGS
- struct control_block next_pcb
- int priority
- address memory_footprint ????
- .
- .
- control_block
8Fixed size partitions
9(No Transcript)
10Variable size partitions
11(No Transcript)
12New request P4 needs 4K Possible?
13(No Transcript)
14(No Transcript)
15Compaction
16Paging and virtual memory
17Physical Memory
LOW
12
Page Table
Users view
15
Page 0
35
Page 1
52
12
Page 2
Page 3
15
35
52
HIGH
18Address translation
Virtual Address
Physical Address
Memory
VPN
Page offset
PPN
Page offset
CPU
PPN
Page table
19- Example 1
- Consider a memory system with a 32-bit
virtual address. Let us assume the pagesize is
8K Bytes. - Example 2
- Consider a memory system with 32-bit virtual
addresses and 24-bit physical memory addresses.
Assume that the pagesize is 4K Bytes. Show the
layout of the virtual and physical addresses.
How big is the page table? How many page frames
are there in this memory system?
20(No Transcript)
21PCB
- enum state_type new, ready, running,
waiting, halted - typedef struct control_block_type
- enum state_type state
- address PC
- int reg_fileNUMREGS
- struct control_block next_pcb
- int priority
- address PTBR
- .
- .
- control_block
22(No Transcript)
23(No Transcript)
24Freelist
25Frame Table
26Disk Map
27- Example
- process P1 page fault at VPN 20.
- free-list is empty.
- selects page frame PFN 52 as the victim.
- frame currently houses VPN 33 of process P4.
28(No Transcript)
29(No Transcript)
30(No Transcript)
31FIFO Page Replacement
32Consider a string of page references by a
process Reference number 1 2 3 4 5
6 7 8 9 10 11 12 13
-------------------------------
--------------------------- Virtual page number
9 0 3 4 0 5 0 6 4 5 0
5 4 Assume there are 3 physical frames.
33Reference 1 (PF)
Reference 2 (PF)
9
Head
9
Head
free
0
Full false
Full false
free
free
Tail
Tail
Reference 3 (PF)
Reference 4 (PF)
9
4
Head
Head
0
0
Full true
Full true
3
3
Tail
Tail
Reference 5 (HIT)
Reference 6 (PF)
4
4
Head
Head
0
5
Full true
Full true
3
3
Tail
Tail
34Consider a string of page references by a
process Reference number 1 2 3 4 5
6 7 8 9 10 11 12 13
-------------------------------
--------------------------- Virtual page number
9 0 3 4 0 5 0 6 4 5 0
5 4
35Beladys Min
Consider a string of page references by a
process Reference number 1 2 3 4 5
6 7 8 9 10 11 12 13
-------------------------------
--------------------------- Virtual page number
9 0 3 4 0 5 0 6 4 5 0
5 4
36LRU
37Consider a string of page references by a
process Reference number 1 2 3 4 5
6 7 8 9 10 11 12 13
-------------------------------
--------------------------- Virtual page number
9 0 3 4 0 5 0 6 4 5 0
5 4 Assume there are 3 physical frames.
38Reference 1 (PF)
Reference 2 (PF)
9
Top
0
Top
free
9
free
Bottom
free
Bottom
Reference 3 (PF)
Reference 4 (PF)
3
Top
4
Top
0
3
9
Bottom
0
Bottom
Reference 5 (HIT)
Reference 6 (PF)
0
Top
5
Top
4
0
3
Bottom
4
Bottom
39Approximate LRU with ref bits
40(No Transcript)
41Optimizations
victim
42(No Transcript)
43(No Transcript)
44(No Transcript)
45(No Transcript)
46TLB
47(No Transcript)
48(No Transcript)
49TLB Hit
Physical Memory
CPU
VPN
Offset
TLB
VPN
PPN
PPN
Offset
VPN
PPN
VPN
PPN
VPN
PPN
VPN
PPN
Page Table
VPN
PPN
50TLB Miss
Physical Memory
CPU
VPN
Offset
TLB
VPN
PPN
PPN
Offset
VPN
PPN
VPN
PPN
VPN
PPN
VPN
PPN
Page Table
VPN
PPN
51TLB Hit
Physical Memory
CPU
Page
Offset
TLB
Page
Frame
Frame
Offset
Page
Frame
Page
Frame
Page
Frame
Page
Frame
Page Table
Page
Frame
52(No Transcript)