Docsity

Paged Virtual Memory and Main Memory Management, Slides of Computer Science

Partial preview of the text

Download Paged Virtual Memory and Main Memory Management and more Slides Computer Science in PDF only on Docsity!

High Performance Computing

Lecture 13

2

Main Memory Management

 Example: Paged Virtual Memory

 Recall: Need for Address Translation

 To translate a virtual address to the corresponding

physical address, a table of translation information is

needed

 The size of the address translation table ..

 … can be reduced by not managing translations on byte basis but at some larger granularity

 Page: fixed size unit of memory (contiguous memory

locations) for which a single piece of translation

information is maintained

4 Paged Virtual Memory 0x 0x 0xFFFFFFFF 0x 0x000000FF Virtual Address Space 0x000001FF

PROGRAM/PROCESS

0x000000 00 0x000001 00 0x000002 00 0xFFFFFFFF 0x000000FF 0x000001FF Virtual Page 0 Virtual Page 1 Virtual Page 0xFFFFFF 0x 000001 24:

5 Paged Virtual Memory 0x 0x 0xFFFFFFFF 0x 0x000000FF Virtual Address Space 0x000001FF

PROGRAM/PROCESS

0x000000 00 0x000001 00 0x000002 00 0xFFFFFFFF 0x000000FF 0x000001FF Virtual Page 0 Virtual Page 1 Virtual Page 0xFFFFFF 0x 000001 24:

Physical Address Space 0x 0xFFFFFF 0x0000FF

256 B

Physical Page 0

MAIN MEMORY

0x 0000 24: If Virtual Page 1 is currently mapped to Physical Page 0

7

PAGE TABLE

Address Translation

Virtual address Physical address Virtual page number (VPN) Offset

PPN

Physical Page Number (PPN) Offset

VPN

8

Keeping Track: Page Table Entry

PPN

VPN

10

Recall: About Memory

 What is memory?

 Something that can remember things

 There are different kinds of memory in a

computer system

 Some remember by the state an electrical circuit

is in

 Others remember by the amount of electrical

charge stored in a capacitor

 Yet others remember by magnetic or optical

properties

 They can vary substantially in their speed

and capacity

e.g., DRAM – “Memory”

e.g., SRAM

e.g., Hard disk drive/Mag Tape, VCD/DVD

11 What’s happening… (^) Hard Disk P1 (^) P2 Pn

Contents of virtual pages Main Memory 0

Page Tables P P Pn

13 What’s happening… (^) Hard Disk P1 (^) P2 Pn

Contents of virtual pages Main Memory 0

Page Tables P P Pn

Question: What if Process P1 now accesses a variable that is on its virtual page 3?

14

Page Fault

 Situation where virtual address generated by

processor is not available in main memory

 Detected on attempt to translate address

 Page Table entry is invalid

16

Page Fault

 Situation where virtual address generated

by processor is not available in main

memory

 Detected on attempt to translate address

 Page Table entry is invalid

 Must be `handled’ by operating system

1. Identify slot in main memory to be used

2. Get page contents from disk

3. Update page table entry

 Data can then be provided to the processor