cmp 301a computer architecture 1 lecture 4. outline zvirtual memory y terminology y page table y...

8
CMP 301A Computer Architecture 1 Lecture 4

Upload: lenard-willis

Post on 29-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

CMP 301AComputer

Architecture 1

Lecture 4

Page 2: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

Outline

Virtual memory

Terminology

Page Table

Translation Lookaside Buffer (TLB)

Page 3: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

Basic Terminology

Main memory acts as a cache for secondary storage “magnetic disk”

Page : Virtual memory block “similar to cache block” Page Fault: Virtual memory miss “similar to cache miss” Virtual address: Address generated by the processor Physical address: Actual address to access the main memory Address Translation: Mapping virtual address to physical one

Page 4: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

Virtual to physical Address Mapping

Page 5: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

Page Table

Virtual to physical translation Indexed by the virtual page number to generate the

physical address Each program has its own page table in memory A special hardware register, page table register is used

to point to the beginning of the table Page table register should be save in context switching

(like PC,...etc) Page table has a V bit to indicate whether the page is in

the memory or not If V=0, the operating system takes control to bring

this page from the magnetic disk.

Page 6: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

Physical address Generation

Example: For 32-bit virtual address, 4KB pages, 4B per page table entry. What is the total size of a page table?Solution: (4GB/4kB)*4B=4MB

Page 7: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

Making Address Translation Fast: The TLB

Every memory access take twice as long: get physical address then get data

To speed up: cache the most recent translation in a Translation Lookaside Buffer (TLB) By the principle of locality, it will be needed soon

Page 8: CMP 301A Computer Architecture 1 Lecture 4. Outline zVirtual memory y Terminology y Page Table y Translation Lookaside Buffer (TLB)

8

Putting it all together