198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14

Size: px
Start display at page:

Download "198:231 Intro to Computer Organization. 198:231 Introduction to Computer Organization Lecture 14"

Transcription

1 98:23 Intro to Computer Organization Lecture 4 Virtual Memory 98:23 Introduction to Computer Organization Lecture 4 Instructor: Nicole Hynes nicole.hynes@rutgers.edu Credits: Several slides courtesy of R. Bryant and D. O Hallaron, CMU

2 98:23 Intro to Computer Organization Lecture 4 Typical Computer Memory Hierarchy L: Registers CPU registers hold words retrieved from L cache Smaller, faster, costlier per byte L2: L: L cache (SRAM) L2 cache (SRAM) L cache holds cache lines retrieved from L2 cache L2 cache holds cache lines retrieved from main memory Larger, slower, cheaper per byte L4: L3: Main memory (DRAM) Local secondary storage (local disks) Main memory holds disk blocks retrieved from local disks Local disks hold files retrieved from disks on remote network servers L5: Remote secondary storage (tapes, distributed file systems, Web servers) 2

3 98:23 Intro to Computer Organization Lecture 4 Caching Caching - Revisited Employed at various levels of the memory hierarchy L cache (or multi-level caches) is used to copy blocks of main memory for quick access by the CPU Similarly, main memory is used to copy blocks of executable files on disk Provide the illusion of a large main memory than actually exists virtual memory Allow sharing on main memory among multiple processes (running programs) CPU Executable File Cache (SRAM) Main memory (DRAM) Disk 3

4 98:23 Intro to Computer Organization Lecture 4 Creating an Executable Program (Review) Compiler Source code Library code Other objects Executable Program Reloc Object code Linker Disk storage Main memory Compiler translates source program(s) into relocatable object code. Linker combines object code with libraries and other objects and outputs executable program on disk. Loader is invoked when executable program is run creates a run-time image, portions of which are loaded into main memory. Loader Run-time Image 4

5 Run-time image: 98:23 Intro to Computer Organization Lecture 4 Unix/Linux Run-Time Image Defines the virtual address space of the program i.e., the set of addresses that the CPU may reference in the program (shown is for a 32-bit Unix/Linux system). Includes: data, text, bss and other segments user stack run-time heap shared libraries Certain portions of the image may be unused or dynamically allocated when the program is running (e.g., user stack, run-time heap). xc x4 x848 Kernel virtual memory User stack (created at runtime) Memory-mapped region for shared libraries Run-time heap (created by malloc) Read/write segment (.data,.bss) Read-only segment (.init,.text,.rodata) Unused Memory invisible to user code %esp (stack pointer) brk Loaded from the executable file 5

6 98:23 Intro to Computer Organization Lecture 4 Virtual and Physical Address Spaces Virtual Address Space Set of addresses that the CPU references during program execution Size of virtual address space is N = 2 n For 32-bit systems n = 32 (4 gigabytes) For 64-bit systems n = 64 ( bytes = 6 exabytes!) Virtual address space consists of addresses {,,..., N-} In practice, ordinary user programs can only reference a subset of the virtual address space (rest is reserved for the OS) Physical Address Space Set of addresses in physical main memory Size of physical address space is M = 2 m Typically M << N (M s of gigabytes) Physical address space consists of addresses {,,..., M-} Clearly, not enough space in physical main memory to accommodate the virtual address space of a single program, let alone several programs. 6

7 98:23 Intro to Computer Organization Lecture 4 Locality to the Rescue Again! Code and data references tend to cluster: Spatial locality: When a virtual address (code or data) is referenced, subsequent references will likely be to items at nearby addresses. Temporal locality: When a virtual address is referenced, it will likely be referenced again in the near future. Virtual addresses Time 7

8 98:23 Intro to Computer Organization Lecture 4 Motivation for Virtual Memory No need to load entire virtual address space of a running program (process) all at once. Because of principle of locality, can dynamically load/unload blocks of the virtual address space as the program is running. Main Memory Disk 8

9 98:23 Intro to Computer Organization Lecture 4 Virtual Memory Techniques Computer systems nowadays employ virtual memory techniques to manage memory: Basic idea: Virtual memory (VM) system transfers blocks of the process virtual address space to/from main memory. VM techniques: Paging: Uses system-defined fixed-size blocks called pages. Segmentation: Uses programmer-defined variable-size blocks called segments. Paging is the dominant virtual memory technique used in contemporary computer systems. Will only discuss paging at an introductory level. Operating systems course (CS 443) covers this topic in depth. 9

10 Key Ideas 98:23 Intro to Computer Organization Lecture 4 Paging Virtual address space is divided into equal-sized blocks called virtual pages. Physical address space is similarly divided into equal-sized blocks called physical pages. A virtual page and a physical page have the same page size P = 2 p bytes. Virtual pages and physical pages are numbered sequentially starting from zero. Virtual Address Space VP VP 2 p bytes Physical Address Space PP PP VP 2 n-p - N- M- PP 2 m-p - Virtual pages (VPs) Physical pages (PPs)

11 98:23 Intro to Computer Organization Lecture 4 How Paging Works Paging When a program is first run, VM system loads the virtual page containing the program s entry point (i.e., main ) into an empty physical page in main memory. As the program is running, the CPU will reference virtual addresses of instructions and data. So long as these virtual addresses belong to the virtual page that is in main memory (page hit), the CPU can access the contents of these virtual addresses from main memory. When the CPU references a virtual address belonging to a virtual page that is currently not in main memory, a page fault occurs. The VM system then fetches the referenced virtual page from disk and loads it into main memory. The CPU then resumes program execution. Thus, paging is nothing more than using main memory as a (DRAM) cache for executable programs residing on disk.

12 98:23 Intro to Computer Organization Lecture 4 Paging At run-time the set of virtual pages of a program can be partitioned into three disjoint subsets: Unallocated: Pages that have not yet been allocated or created by the VM system e.g., unused portions of the user stack or run-time heap. Cached: Allocated pages that are currently cached in physical main memory. Uncached: Allocated pages that are not cached in physical memory. Virtual memory Physical memory VP VP Unallocated Cached Uncached Unallocated Empty Empty PP PP Cached VP 2 n-p - Uncached Cached Uncached N- M- Empty PP 2 m-p - Virtual pages (VPs) stored on disk Physical pages (PPs) cached in DRAM 2

13 98:23 Intro to Computer Organization Lecture 4 Page Table Page Tables In-memory data structure maintained by the VM system to keep track of the state (cached/uncached/ unallocated) and location of each virtual page. One page table entry (PTE) per virtual page. Valid bit: means virtual page is currently cached in physical memory. means virtual page in not cached in physical memory. Location: If valid = (cached), specifies physical page number to which virtual page is mapped. If valid = (uncached), specifies disk address of virtual page if allocated. If virtual page is unallocated, location = NULL. Valid PTE PTE PTE 2... Location (Physical page number or disk address) Memory resident page table (DRAM) 3

14 98:23 Intro to Computer Organization Lecture 4 Page Table - Illustration Assume 8 virtual pages VP VP 7 VPs and 5 are unallocated Page Tables VPs, 2, 4, 7 are cached; VPs 3 and 6 are not Valid PTE PTE PTE 2 PTE 3 PTE 4 PTE 5 PTE 6 PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 4 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 PP PP 3 4

15 98:23 Intro to Computer Organization Lecture 4 Page Hit Page hit occurs when virtual address referenced belongs to a cached virtual page. Virtual address Valid PTE PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 4 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 VP 7 PP PP 3 5

16 98:23 Intro to Computer Organization Lecture 4 Page Fault Page fault occurs when virtual address referenced belongs to an uncached virtual page. Virtual address Valid PTE PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 4 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 VP 7 PP PP 3 6

17 98:23 Intro to Computer Organization Lecture 4 Handling a Page Fault Page fault causes an exception (interrupts running program). Virtual address Valid PTE PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 4 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 VP 7 PP PP 3 7

18 98:23 Intro to Computer Organization Lecture 4 Handling a Page Fault Page fault handler selects a victim to be evicted (here VP 4). Virtual address Valid PTE PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 4 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 VP 7 PP PP 3 8

19 98:23 Intro to Computer Organization Lecture 4 Handling a Page Fault Page fault handler selects a victim to be evicted (here VP 4). Virtual address Valid PTE PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 3 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 VP 7 PP PP 3 9

20 98:23 Intro to Computer Organization Lecture 4 Handling a Page Fault Offending instruction is restarted now a page hit. Virtual address Valid PTE PTE 7 Physical page number or disk address null null Memory resident page table (DRAM) Physical memory (DRAM) VP VP 2 VP 7 VP 3 Virtual memory (disk) VP VP 2 VP 3 VP 4 VP 6 VP 7 PP PP 3 2

21 98:23 Intro to Computer Organization Lecture 4 VM Supports Multiprogramming Can have several running programs (processes) at the same time. Each process has its own virtual address space, but number of active virtual pages (working set) per process is typically not large. Therefore, VM system can cache working sets of several processes in physical memory at the same time. VM allows processes to share code and data (e.g., library code) by mapping virtual pages to the same physical page (here PP 6) 2

22 98:23 Intro to Computer Organization Lecture 4 Practical Considerations Virtual memory works because of locality: Programs with better locality will have smaller working sets If ( working set size < main memory size ) Good performance for one process after compulsory misses If ( SUM(working set sizes) > main memory size ) Thrashing: Performance meltdown where pages are swapped (copied) in and out continuously DRAM physical memory as cache for disk is driven by the enormous miss penalty: DRAM is about x slower than SRAM But disk is about,x slower than DRAM Consequences: Large page (block) size: typically 4-8 KB, sometimes 4 MB Fully associative - any VP can be placed in any PP Highly sophisticated, expensive page replacement algorithms Page writes: write-back rather than write-through Set dirty bit on write Write back to disk on page-out if dirty bit is set 22

23 Virtual Address Space V = {,,, N} Physical Address Space P = {,,, M} Address Translation MAP: V P U { } For virtual address a: 98:23 Intro to Computer Organization Lecture 4 VM Address Translation MAP(a) = a if data at virtual address a is at physical address a in P MAP(a) = if data at virtual address a is not in physical memory» Either invalid or stored on disk Address translation is performed by memory management unit (MMU) 23

24 98:23 Intro to Computer Organization Lecture 4 Summary of Address Translation Symbols Basic Parameters N = 2 n : Number of addresses in virtual address space M = 2 m : Number of addresses in physical address space P = 2 p : Page size (bytes) Components of the virtual address (VA) VPO: Virtual page offset (p bits) VPN: Virtual page number (n-p bits) n- p p- Virtual page number (VPN) Virtual page offset (VPO) Components of the physical address (PA) PPO: Physical page offset (p bits) PPN: Physical page number (m-p bits) m- p p- Physical page number (PPN) Physical page offset (PPO) 24

25 98:23 Intro to Computer Organization Lecture 4 Address Translation With a Page Table Page table base register (PTBR) n- Virtual page number (VPN) Virtual address p p- Virtual page offset (VPO) Page table address for process Page table Valid Physical page number (PPN) Valid bit = : page not in memory (page fault) m- p p- Physical page number (PPN) Physical address Physical page offset (PPO) 25

26 98:23 Intro to Computer Organization Lecture 4 Address Translation: Page Hit CPU Chip CPU VA MMU 2 PTEA PTE 3 PA Cache/ Memory 4 Data 5 ) CPU sends virtual address to MMU (memory management unit) 2-3) MMU fetches PTE from page table in memory 4) MMU sends physical address to cache/memory 5) Cache/memory sends data word to CPU VA: virtual address, PA: physical address, PTE: page table entry, PTEA = PTE address 26

27 98:23 Intro to Computer Organization Lecture 4 Address Translation: Page Fault Exception 4 Page fault handler CPU Chip CPU VA 7 MMU 2 PTEA PTE 3 Cache/ Memory Victim page 5 New page Disk 6 ) CPU sends virtual address to MMU 2-3) MMU fetches PTE from page table in memory 4) Valid bit is zero, so MMU triggers page fault exception 5) Handler identifies victim (and, if dirty, pages it out to disk) 6) Handler pages in new page and updates PTE in memory 7) Handler returns to original process, restarting faulting instruction 27

28 98:23 Intro to Computer Organization Lecture 4 VM Address Translation Example Basic Parameters N = 2 4 virtual addresses 4-bit virtual addresses M = 2 2 physical addresses 2-bit physical address Page size = 2 6 = 64 bytes Number of virtual pages = 2 4 /2 6 = 2 8 = 256 Number of physical pages = 2 2 /2 6 = 2 6 = 64 28

29 98:23 Intro to Computer Organization Lecture 4 VM Address Translation Example Consider the following snapshot of the page table: Page table has 256 PTEs; will only show first 6 PTEs VPNs and PPNs are in hex VPN PPN Valid VPN PPN Valid A B 4 C 5 6 D 2D 6 E 7 F D 29

30 98:23 Intro to Computer Organization Lecture 4 VM Address Translation Example. Suppose the CPU references virtual address x3d VPN = xf VPO VPN PPN Valid VPN PPN Valid A B 4 C 5 6 D 2D 6 7 E F D page hit Physical address = x PPN = xd PPO = VPO 3

31 98:23 Intro to Computer Organization Lecture 4 VM Address Translation Example 2. Suppose the CPU references virtual address x2cf VPN = xb VPO VPN PPN Valid VPN PPN Valid A B page fault 4 C 5 6 D 2D 6 E 7 F D Assume page fault handler loads virtual page to main memory at PPN x2a. 3

32 98:23 Intro to Computer Organization Lecture 4 VM Address Translation Example 2. Suppose the CPU references virtual address x2cf VPN = xb VPO VPN PPN Valid VPN PPN Valid A B C D 7 9 2A 2D page table updated after loading virtual page to MM 6 E 7 F D Physical address = xa8f PPN = x2a PPO = VPO 32

33 98:23 Intro to Computer Organization Lecture 4 Integrating VM and Cache PTE CPU Chip CPU VA Data 9 MMU 3 PTEA 2 PA PTEA hit PA hit PTEA miss PA miss PTE 5 PTEA PA 6 7 Data L cache 4 8 Memory ) CPU sends virtual address to MMU 2-5) MMU fetches PTE from cache if miss, load from memory 6-8) MMU sends physical address to cache if miss, load from memory 9) Cache sends data word to CPU 33

34 98:23 Intro to Computer Organization Lecture 4 Speeding up Translation with a TLB Page table entries (PTEs) are cached in L like any other memory word PTEs may be evicted by other data references PTE hit still requires a small L delay Solution: Translation Lookaside Buffer (TLB) Small hardware cache in MMU Maps virtual page numbers to physical page numbers Contains complete page table entries for small number of pages Components of a virtual address used to access the TLB n- p+t p+t- p p- TLB tag TLB set index VPO VPN 34

35 98:23 Intro to Computer Organization Lecture 4 TLB Hit CPU Chip TLB A TLB hit eliminates a memory access 2 PTE VPN 3 CPU VA MMU PA 4 Cache/ Memory Data ) CPU sends virtual address to MMU 5 2-3) MMU fetches appropriate PTE from TLB 4) MMU translates virtual address to physical address and sends it to cache/memory 5) Cache/memory sends data word to CPU 35

36 98:23 Intro to Computer Organization Lecture 4 TLB Miss CPU Chip TLB 4 A TLB miss incurs an extra memory access (the PTE) 2 PTE VPN 3 CPU VA MMU PTEA PA Cache/ Memory 5 Data ) CPU sends virtual address to MMU 6 2) MMU fetches appropriate PTE from TLB 3-4) On TLB miss, MMU fetches PTE from page table in memory and stores it in TLB 5) MMU translates virtual address to physical address and sends it to cache/memory 6) Cache/memory sends data word to CPU 36

37 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Virtual and Physical Address Spaces 4-bit virtual addresses 2-bit physical address Page size = 64 bytes VPN (Virtual Page Number) VPO (Virtual Page Offset) PPN (Physical Page Number) PPO (Physical Page Offset) 37

38 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table Page table has 256 PTEs; will only show first 6 PTEs Assume all other VPNs not allocated in main memory VPN PPN Valid VPN PPN Valid A B 4 C 5 6 D 2D 6 E 7 F D 38

39 TLB 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB 6 entries 4-way associative TLBT TLBI VPN VPO Set Tag PPN Valid Tag PPN Valid Tag PPN Valid Tag PPN Valid 3 9 D D 2 4 A D A

40 98:23 Intro to Computer Organization Lecture 4 Cache All Together Now: VM with Cache + TLB 6 lines; 4-byte line size Direct mapped CT CI CO PPN PPO Idx Tag Valid B B B2 B3 Idx Tag Valid B B B2 B A D 2 B A 2D 93 5 DA 3B 3 36 B B D 8F 9 C 2 5 D F D D E B D3 7 6 C2 DF 3 F 4 4

41 Ex. Virtual Address x3d4 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address VPN xf 3 x3 VPO CT CI CO PPN PPO CO CI CT Cache Hit? Byte: 4

42 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table TLB Cache 42

43 Ex. Virtual Address x3d4 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address VPN VPO xf 3 x3 Y NO xd CT CI CO PPN PPO x5 xd CO CI CT Cache Hit? Byte: 43

44 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table TLB Cache 44

45 Ex. Virtual Address x3d4 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address VPN VPO xf 3 x3 Y NO xd CT CI CO PPN PPO x5 xd Y x36 CO CI CT Cache Hit? Byte: 45

46 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Ex 2. Virtual Address xb8f TLBT TLBI VPN VPO x2e 2 xb VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI CT Cache Hit? Byte: 46

47 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table TLB tag = xb not in set 2 TLB miss TLB Cache 47

48 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Ex 2. Virtual Address xb8f TLBT TLBI VPN VPO x2e 2 xb NO VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI CT Cache Hit? Byte: 48

49 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table VPN x2e not in MM page fault TLB Cache 49

50 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Ex 2. Virtual Address xb8f TLBT TLBI VPN VPO x2e 2 xb NO YES TBD VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI CT Cache Hit? Byte: 5

51 Ex 3. Virtual Address x2 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN VPO x x VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI CT Cache Hit? Byte: 5

52 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table TLB tag = x in set but Valid = TLB miss TLB Cache 52

53 Ex 3. Virtual Address x2 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN VPO x x NO VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI CT Cache Hit? Byte: 53

54 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table TLB Cache 54

55 Ex 3. Virtual Address x2 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN VPO x x NO NO x28 VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI x8 CT x28 Cache Hit? Byte: 55

56 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB Page Table Cache tag = x28 not in set 8 cache miss TLB Cache 56

57 Ex 3. Virtual Address x2 98:23 Intro to Computer Organization Lecture 4 All Together Now: VM with Cache + TLB TLBT TLBI VPN VPO x x NO NO x28 VPN TLBI TLBT TLB Hit? Page Fault? PPN: Physical Address CT CI CO PPN PPO CO CI x8 CT x28 Cache Hit? NO Byte: MEM 57

58 98:23 Intro to Computer Organization Lecture 4 Flat page table can be huge Multi-Level Page Table Consider a 32-bit virtual address space as on modern computers Page size of 4 KB (2 2 ) Page table would have million entries (2 32 / 2 2 ) If each entry is 4 bytes 4 MB of physical memory for page table alone! Multi-level page table Page table is organized as a tree of smaller page tables Obtained by subdividing page number field of virtual address into two or more subfields 58

59 98:23 Intro to Computer Organization Lecture 4 Two-Level Page Table Consider a 32-bit virtual address space, pages of size 4K (= 2 2 ) bytes each: Page number field will consist of 2 bits Page offset field will consist of 2 bits Now divide the 2-bit page number field further into two fields p and p 2 each bits wide: page number page offset p p 2 offset 2 This gives rise to a two-level page table p index to outer page table; holds pointer to an inner table p 2 index to inner table; holds frame number corresponding to page 59

60 98:23 Intro to Computer Organization Lecture 4 Two-Level Page Table Virtual address 2 p p 2 off Outer page table Inner page table Inner page table p Inner page table p p 2 PPN Inner page table 23 PPN off Physical address

61 98:23 Intro to Computer Organization Lecture 4 Two-Level Page Table Virtual address 2 p p 2 off At most two tables retrieved from disk; each can fit in a page Outer page table Inner page table Inner page table p Inner page table p p 2 PPN Inner page table 23 PPN off Physical address

62 98:23 Intro to Computer Organization Lecture 4 Summary Programmer s view of virtual memory Each process has its own private linear address space Cannot be corrupted by other processes System view of virtual memory Uses memory efficiently by caching virtual memory pages Efficient only because of locality Simplifies memory management and programming Simplifies protection by providing a convenient interpositioning point to check permissions 62

Computer Systems. Virtual Memory. Han, Hwansoo

Computer Systems. Virtual Memory. Han, Hwansoo Computer Systems Virtual Memory Han, Hwansoo A System Using Physical Addressing CPU Physical address (PA) 4 Main memory : : 2: 3: 4: 5: 6: 7: 8:... M-: Data word Used in simple systems like embedded microcontrollers

More information

Carnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition

Carnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition Carnegie Mellon Virtual Memory: Concepts 5-23: Introduction to Computer Systems 7 th Lecture, October 24, 27 Instructor: Randy Bryant 2 Hmmm, How Does This Work?! Process Process 2 Process n Solution:

More information

14 May 2012 Virtual Memory. Definition: A process is an instance of a running program

14 May 2012 Virtual Memory. Definition: A process is an instance of a running program Virtual Memory (VM) Overview and motivation VM as tool for caching VM as tool for memory management VM as tool for memory protection Address translation 4 May 22 Virtual Memory Processes Definition: A

More information

Processes and Virtual Memory Concepts

Processes and Virtual Memory Concepts Processes and Virtual Memory Concepts Brad Karp UCL Computer Science CS 37 8 th February 28 (lecture notes derived from material from Phil Gibbons, Dave O Hallaron, and Randy Bryant) Today Processes Virtual

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 53 Design of Operating Systems Winter 28 Lecture 6: Paging/Virtual Memory () Some slides modified from originals by Dave O hallaron Today Address spaces VM as a tool for caching VM as a tool for memory

More information

This lecture. Virtual Memory. Virtual memory (VM) CS Instructor: Sanjeev Se(a

This lecture. Virtual Memory. Virtual memory (VM) CS Instructor: Sanjeev Se(a Virtual Memory Instructor: Sanjeev Se(a This lecture (VM) Overview and mo(va(on VM as tool for caching VM as tool for memory management VM as tool for memory protec(on Address transla(on 2 Virtual Memory

More information

Virtual Memory: Concepts

Virtual Memory: Concepts Virtual Memory: Concepts 5-23: Introduction to Computer Systems 7 th Lecture, March 2, 27 Instructors: Franz Franchetti & Seth Copen Goldstein Hmmm, How Does This Work?! Process Process 2 Process n Solution:

More information

Carnegie Mellon. 16 th Lecture, Mar. 20, Instructors: Todd C. Mowry & Anthony Rowe

Carnegie Mellon. 16 th Lecture, Mar. 20, Instructors: Todd C. Mowry & Anthony Rowe Virtual Memory: Concepts 5 23 / 8 23: Introduction to Computer Systems 6 th Lecture, Mar. 2, 22 Instructors: Todd C. Mowry & Anthony Rowe Today Address spaces VM as a tool lfor caching VM as a tool for

More information

Virtual Memory: Concepts

Virtual Memory: Concepts Virtual Memory: Concepts Instructor: Dr. Hyunyoung Lee Based on slides provided by Randy Bryant and Dave O Hallaron Today Address spaces VM as a tool for caching VM as a tool for memory management VM as

More information

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Systems Programming and Computer Architecture ( ) Timothy Roscoe Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-6-) Timothy Roscoe Herbstsemester 26 AS 26 Virtual Memory 8: Virtual Memory Computer Architecture

More information

Virtual Memory. CS61, Lecture 15. Prof. Stephen Chong October 20, 2011

Virtual Memory. CS61, Lecture 15. Prof. Stephen Chong October 20, 2011 Virtual Memory CS6, Lecture 5 Prof. Stephen Chong October 2, 2 Announcements Midterm review session: Monday Oct 24 5:3pm to 7pm, 6 Oxford St. room 33 Large and small group interaction 2 Wall of Flame Rob

More information

Lecture 19: Virtual Memory: Concepts

Lecture 19: Virtual Memory: Concepts CSCI-UA.2-3 Computer Systems Organization Lecture 9: Virtual Memory: Concepts Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark Barrett

More information

Virtual Memory. Alan L. Cox Some slides adapted from CMU slides

Virtual Memory. Alan L. Cox Some slides adapted from CMU slides Alan L. Cox alc@rice.edu Some slides adapted from CMU 5.23 slides Objectives Be able to explain the rationale for VM Be able to explain how VM is implemented Be able to translate virtual addresses to physical

More information

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia Virtual Memory II CSE 35 Autumn 27 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan https://xkcd.com/495/

More information

Roadmap. Java: Assembly language: OS: Machine code: Computer system:

Roadmap. Java: Assembly language: OS: Machine code: Computer system: Roadmap C: car *c = malloc(sizeof(car)); c->miles = ; c->gals = 7; float mpg = get_mpg(c); free(c); Assembly language: Machine code: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp %rbp Java: Car c = new

More information

University of Washington Virtual memory (VM)

University of Washington Virtual memory (VM) Virtual memory (VM) Overview and mo-va-on VM as tool for caching VM as tool for memory management VM as tool for memory protec-on Address transla-on Processes Defini=on: A process is an instance of a running

More information

Virtual Memory Oct. 29, 2002

Virtual Memory Oct. 29, 2002 5-23 The course that gives CMU its Zip! Virtual Memory Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs class9.ppt Motivations for Virtual Memory Use Physical

More information

VM as a cache for disk

VM as a cache for disk Virtualization Virtual Memory Computer Systems Organization (Spring 2017) CSCI-UA 201, Section 3 Instructor: Joanna Klukowska Virtualization of a resource: presenting a user with a different view of that

More information

Virtual Memory: Concepts

Virtual Memory: Concepts Virtual Memory: Concepts 5-23 / 8-23: Introduc=on to Computer Systems 6 th Lecture, Mar. 8, 24 Instructors: Anthony Rowe, Seth Goldstein, and Gregory Kesden Today VM Movaon and Address spaces ) VM as a

More information

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia Virtual Memory II CSE 35 Autumn 26 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun https://xkcd.com/495/

More information

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk

Motivations for Virtual Memory Virtual Memory Oct. 29, Why VM Works? Motivation #1: DRAM a Cache for Disk class8.ppt 5-23 The course that gives CMU its Zip! Virtual Oct. 29, 22 Topics Motivations for VM Address translation Accelerating translation with TLBs Motivations for Virtual Use Physical DRAM as a Cache

More information

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs

Virtual Memory. Motivations for VM Address translation Accelerating translation with TLBs Virtual Memory Today Motivations for VM Address translation Accelerating translation with TLBs Fabián Chris E. Bustamante, Riesbeck, Fall Spring 2007 2007 A system with physical memory only Addresses generated

More information

CISC 360. Virtual Memory Dec. 4, 2008

CISC 360. Virtual Memory Dec. 4, 2008 CISC 36 Virtual Dec. 4, 28 Topics Motivations for VM Address translation Accelerating translation with TLBs Motivations for Virtual Use Physical DRAM as a Cache for the Disk Address space of a process

More information

Foundations of Computer Systems

Foundations of Computer Systems 8-6 Foundations of Computer Systems Lecture 5: Virtual Memory Concepts and Systems October 8, 27 8-6 SE PL OS CA Required Reading Assignment: Chapter 9 of CS:APP (3 rd edition) by Randy Bryant & Dave O

More information

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics

Random-Access Memory (RAM) Systemprogrammering 2007 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics Systemprogrammering 27 Föreläsning 4 Topics The memory hierarchy Motivations for VM Address translation Accelerating translation with TLBs Random-Access (RAM) Key features RAM is packaged as a chip. Basic

More information

CSE 351. Virtual Memory

CSE 351. Virtual Memory CSE 351 Virtual Memory Virtual Memory Very powerful layer of indirection on top of physical memory addressing We never actually use physical addresses when writing programs Every address, pointer, etc

More information

Understanding the Design of Virtual Memory. Zhiqiang Lin

Understanding the Design of Virtual Memory. Zhiqiang Lin CS 6V8-05: System Security and Malicious Code Analysis Understanding the Design of Virtual Memory Zhiqiang Lin Department of Computer Science University of Texas at Dallas February 27 th, 202 Outline Basic

More information

Random-Access Memory (RAM) Systemprogrammering 2009 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics! The memory hierarchy

Random-Access Memory (RAM) Systemprogrammering 2009 Föreläsning 4 Virtual Memory. Locality. The CPU-Memory Gap. Topics! The memory hierarchy Systemprogrammering 29 Föreläsning 4 Topics! The memory hierarchy! Motivations for VM! Address translation! Accelerating translation with TLBs Random-Access (RAM) Key features! RAM is packaged as a chip.!

More information

Virtual Memory II CSE 351 Spring

Virtual Memory II CSE 351 Spring Virtual Memory II CSE 351 Spring 2018 https://xkcd.com/1495/ Virtual Memory (VM) Overview and motivation VM as a tool for caching Address translation VM as a tool for memory management VM as a tool for

More information

Virtual Memory Nov 9, 2009"

Virtual Memory Nov 9, 2009 Virtual Memory Nov 9, 2009" Administrivia" 2! 3! Motivations for Virtual Memory" Motivation #1: DRAM a Cache for Disk" SRAM" DRAM" Disk" 4! Levels in Memory Hierarchy" cache! virtual memory! CPU" regs"

More information

VIRTUAL MEMORY: CONCEPTS

VIRTUAL MEMORY: CONCEPTS VIRTUAL MEMORY: CONCEPTS CS 45 Computer Organization and Architecture Prof. Donald J. Patterson Adapted from Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition VIRTUAL MEMORY:

More information

Virtual Memory. Physical Addressing. Problem 2: Capacity. Problem 1: Memory Management 11/20/15

Virtual Memory. Physical Addressing. Problem 2: Capacity. Problem 1: Memory Management 11/20/15 Memory Addressing Motivation: why not direct physical memory access? Address translation with pages Optimizing translation: translation lookaside buffer Extra benefits: sharing and protection Memory as

More information

A Few Problems with Physical Addressing. Virtual Memory Process Abstraction, Part 2: Private Address Space

A Few Problems with Physical Addressing. Virtual Memory Process Abstraction, Part 2: Private Address Space Process Abstraction, Part : Private Motivation: why not direct physical memory access? Address translation with pages Optimizing translation: translation lookaside buffer Extra benefits: sharing and protection

More information

virtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk

virtual memory. March 23, Levels in Memory Hierarchy. DRAM vs. SRAM as a Cache. Page 1. Motivation #1: DRAM a Cache for Disk 5-23 March 23, 2 Topics Motivations for VM Address translation Accelerating address translation with TLBs Pentium II/III system Motivation #: DRAM a Cache for The full address space is quite large: 32-bit

More information

Virtual Memory. Samira Khan Apr 27, 2017

Virtual Memory. Samira Khan Apr 27, 2017 Virtual Memory Samira Khan Apr 27, 27 Virtual Memory Idea: Give the programmer the illusion of a large address space while having a small physical memory So that the programmer does not worry about managing

More information

Virtual Memory. Computer Systems Principles

Virtual Memory. Computer Systems Principles Virtual Memory Computer Systems Principles Objectives Virtual Memory What is it? How does it work? Virtual Memory Address Translation /7/25 CMPSCI 23 - Computer Systems Principles 2 Problem Lots of executing

More information

virtual memory Page 1 CSE 361S Disk Disk

virtual memory Page 1 CSE 361S Disk Disk CSE 36S Motivations for Use DRAM a for the Address space of a process can exceed physical memory size Sum of address spaces of multiple processes can exceed physical memory Simplify Management 2 Multiple

More information

Virtual Memory: Systems

Virtual Memory: Systems Virtual Memory: Systems 5-23: Introduction to Computer Systems 8 th Lecture, March 28, 27 Instructor: Franz Franchetti & Seth Copen Goldstein Recap: Hmmm, How Does This Work?! Process Process 2 Process

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 24 LAST TIME Extended virtual memory concept to be a cache of memory stored on disk DRAM becomes L4 cache of data stored on L5 disk Extend page

More information

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson Virtual Memory I CSE 35 Spring 27 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Midterms Graded If you did

More information

P6/Linux Memory System Nov 11, 2009"

P6/Linux Memory System Nov 11, 2009 P6/Linux Memory System Nov 11, 2009" REMEMBER" 2! 3! Intel P6" P6 Memory System" DRAM" external system bus (e.g. PCI)" L2" cache" cache bus! bus interface unit" inst" TLB" instruction" fetch unit" L1"

More information

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation

@2010 Badri Computer Architecture Assembly II. Virtual Memory. Topics (Chapter 9) Motivations for VM Address translation Virtual Memory Topics (Chapter 9) Motivations for VM Address translation 1 Motivations for Virtual Memory Use Physical DRAM as a Cache for the Disk Address space of a process can exceed physical memory

More information

Memory System Case Studies Oct. 13, 2008

Memory System Case Studies Oct. 13, 2008 Topics 15-213 Memory System Case Studies Oct. 13, 2008 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping Class15+.ppt Intel P6 (Bob Colwell s Chip,

More information

Pentium/Linux Memory System March 17, 2005

Pentium/Linux Memory System March 17, 2005 15-213 The course that gives CMU its Zip! Topics Pentium/Linux Memory System March 17, 2005 P6 address translation x86-64 extensions Linux memory management Linux page fault handling Memory mapping 17-linuxmem.ppt

More information

Memory Management! How the hardware and OS give application pgms:" The illusion of a large contiguous address space" Protection against each other"

Memory Management! How the hardware and OS give application pgms: The illusion of a large contiguous address space Protection against each other Memory Management! Goals of this Lecture! Help you learn about:" The memory hierarchy" Spatial and temporal locality of reference" Caching, at multiple levels" Virtual memory" and thereby " How the hardware

More information

Virtual Memory: Systems

Virtual Memory: Systems Virtual Memory: Systems 5-23 / 8-23: Introduc2on to Computer Systems 7 th Lecture, Mar. 22, 22 Instructors: Todd C. Mowry & Anthony Rowe Today Virtual memory ques7ons and answers Simple memory system example

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 53 Design of Operating Systems Spring 8 Lectre 6: Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals by Dave

More information

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. November 15, MIT Fall 2018 L20-1 Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L20-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:

More information

Memory Management! Goals of this Lecture!

Memory Management! Goals of this Lecture! Memory Management! Goals of this Lecture! Help you learn about:" The memory hierarchy" Why it works: locality of reference" Caching, at multiple levels" Virtual memory" and thereby " How the hardware and

More information

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1

Virtual Memory. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. April 12, 2018 L16-1 Virtual Memory Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. L16-1 Reminder: Operating Systems Goals of OS: Protection and privacy: Processes cannot access each other s data Abstraction:

More information

Memory Management. Goals of this Lecture. Motivation for Memory Hierarchy

Memory Management. Goals of this Lecture. Motivation for Memory Hierarchy Memory Management Goals of this Lecture Help you learn about: The memory hierarchy Spatial and temporal locality of reference Caching, at multiple levels Virtual memory and thereby How the hardware and

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 53 Design of Operating Systems Spring 8 Lectre 9: Locality and Cache Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 17: Advanced Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

University*of*Washington*

University*of*Washington* Roadmap C: car c = malloc(sizeof(car)); c->miles = 100; c->gals = 17; float mpg = get_mpg(c); free(c); Assembly language: Machine code: Computer system: get_mpg: pushq movq... popq ret %rbp %rsp, %rbp

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 23

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 23 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 208 Lecture 23 LAST TIME: VIRTUAL MEMORY Began to focus on how to virtualize memory Instead of directly addressing physical memory, introduce a level of indirection

More information

Another View of the Memory Hierarchy. Lecture #25 Virtual Memory I Memory Hierarchy Requirements. Memory Hierarchy Requirements

Another View of the Memory Hierarchy. Lecture #25 Virtual Memory I Memory Hierarchy Requirements. Memory Hierarchy Requirements CS61C L25 Virtual I (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #25 Virtual I 27-8-7 Scott Beamer, Instructor Another View of the Hierarchy Thus far{ Next: Virtual { Regs Instr.

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 23

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 23 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 205 Lecture 23 LAST TIME: VIRTUAL MEMORY! Began to focus on how to virtualize memory! Instead of directly addressing physical memory, introduce a level of

More information

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

Memory Hierarchy Requirements. Three Advantages of Virtual Memory CS61C L12 Virtual (1) CS61CL : Machine Structures Lecture #12 Virtual 2009-08-03 Jeremy Huddleston Review!! Cache design choices: "! Size of cache: speed v. capacity "! size (i.e., cache aspect ratio)

More information

Virtual Memory. CS 3410 Computer System Organization & Programming

Virtual Memory. CS 3410 Computer System Organization & Programming Virtual Memory CS 3410 Computer System Organization & Programming These slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer. Where are we now and

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory. Bernhard Boser & Randy Katz

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory. Bernhard Boser & Randy Katz CS 61C: Great Ideas in Computer Architecture Lecture 23: Virtual Memory Bernhard Boser & Randy Katz http://inst.eecs.berkeley.edu/~cs61c Agenda Virtual Memory Paged Physical Memory Swap Space Page Faults

More information

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory. Virtual Memory 1 Learning Outcomes An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory. 2 Memory Management Unit (or TLB) The position and function

More information

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Use main memory as a cache for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs

More information

COSC3330 Computer Architecture Lecture 20. Virtual Memory

COSC3330 Computer Architecture Lecture 20. Virtual Memory COSC3330 Computer Architecture Lecture 20. Virtual Memory Instructor: Weidong Shi (Larry), PhD Computer Science Department University of Houston Virtual Memory Topics Reducing Cache Miss Penalty (#2) Use

More information

John Wawrzynek & Nick Weaver

John Wawrzynek & Nick Weaver CS 61C: Great Ideas in Computer Architecture Lecture 23: Virtual Memory John Wawrzynek & Nick Weaver http://inst.eecs.berkeley.edu/~cs61c From Previous Lecture: Operating Systems Input / output (I/O) Memory

More information

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory.

Learning Outcomes. An understanding of page-based virtual memory in depth. Including the R3000 s support for virtual memory. Virtual Memory Learning Outcomes An understanding of page-based virtual memory in depth. Including the R000 s support for virtual memory. Memory Management Unit (or TLB) The position and function of the

More information

Chapter 8. Virtual Memory

Chapter 8. Virtual Memory Operating System Chapter 8. Virtual Memory Lynn Choi School of Electrical Engineering Motivated by Memory Hierarchy Principles of Locality Speed vs. size vs. cost tradeoff Locality principle Spatial Locality:

More information

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy

Chapter 5B. Large and Fast: Exploiting Memory Hierarchy Chapter 5B Large and Fast: Exploiting Memory Hierarchy One Transistor Dynamic RAM 1-T DRAM Cell word access transistor V REF TiN top electrode (V REF ) Ta 2 O 5 dielectric bit Storage capacitor (FET gate,

More information

Virtual Memory I. CSE 351 Winter Instructor: Mark Wyse

Virtual Memory I. CSE 351 Winter Instructor: Mark Wyse http://rebrn.com/re/bad-chrome-6282/ Virtual Memory I CSE 35 Winter 28 Instructor: Mark Wyse Teaching Assistants: Kevin Bi Parker DeWilde Emily Furst Sarah House Waylon Huang Vinny Palaniappan Administrative

More information

Virtual Memory. Spring Instructors: Aykut and Erkut Erdem

Virtual Memory. Spring Instructors: Aykut and Erkut Erdem Virtual Memory Spring 22 Instructors: Aykut and Erkut Erdem Acknowledgement: The course slides are adapted from the slides prepared by R.E. Bryant, D.R. O Hallaron, G. Kesden and Markus Püschel of Carnegie-

More information

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

Virtual Memory. Stefanos Kaxiras. Credits: Some material and/or diagrams adapted from Hennessy & Patterson, Hill, online sources.

Virtual Memory. Stefanos Kaxiras. Credits: Some material and/or diagrams adapted from Hennessy & Patterson, Hill, online sources. Virtual Memory Stefanos Kaxiras Credits: Some material and/or diagrams adapted from Hennessy & Patterson, Hill, online sources. Caches Review & Intro Intended to make the slow main memory look fast by

More information

Address Translation. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Address Translation. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University Address Translation Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics How to reduce the size of page tables? How to reduce the time for

More information

CS 261 Fall Mike Lam, Professor. Virtual Memory

CS 261 Fall Mike Lam, Professor. Virtual Memory CS 261 Fall 2016 Mike Lam, Professor Virtual Memory Topics Operating systems Address spaces Virtual memory Address translation Memory allocation Lingering questions What happens when you call malloc()?

More information

18-447: Computer Architecture Lecture 16: Virtual Memory

18-447: Computer Architecture Lecture 16: Virtual Memory 18-447: Computer Architecture Lecture 16: Virtual Memory Justin Meza Carnegie Mellon University (with material from Onur Mutlu, Michael Papamichael, and Vivek Seshadri) 1 Notes HW 2 and Lab 2 grades will

More information

VIRTUAL MEMORY II. Jo, Heeseung

VIRTUAL MEMORY II. Jo, Heeseung VIRTUAL MEMORY II Jo, Heeseung TODAY'S TOPICS How to reduce the size of page tables? How to reduce the time for address translation? 2 PAGE TABLES Space overhead of page tables The size of the page table

More information

Virtual Memory. Virtual Memory

Virtual Memory. Virtual Memory Virtual Memory Virtual Memory Main memory is cache for secondary storage Secondary storage (disk) holds the complete virtual address space Only a portion of the virtual address space lives in the physical

More information

Agenda. CS 61C: Great Ideas in Computer Architecture. Virtual Memory II. Goals of Virtual Memory. Memory Hierarchy Requirements

Agenda. CS 61C: Great Ideas in Computer Architecture. Virtual Memory II. Goals of Virtual Memory. Memory Hierarchy Requirements CS 61C: Great Ideas in Computer Architecture Virtual II Guest Lecturer: Justin Hsia Agenda Review of Last Lecture Goals of Virtual Page Tables Translation Lookaside Buffer (TLB) Administrivia VM Performance

More information

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory

CS 61C: Great Ideas in Computer Architecture. Lecture 23: Virtual Memory CS 61C: Great Ideas in Computer Architecture Lecture 23: Virtual Memory Krste Asanović & Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c/fa17 1 Agenda Virtual Memory Paged Physical Memory Swap Space

More information

Virtual Memory. CS 3410 Computer System Organization & Programming. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Virtual Memory. CS 3410 Computer System Organization & Programming. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Virtual Memory CS 3410 Computer System Organization & Programming [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon] Click any letter let me know you re here today. Instead of a DJ Clicker Question today,

More information

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation The Virtual Memory Abstraction Memory Management Physical Memory Unprotected address space Limited size Shared physical frames Easy to share data Virtual Memory Programs are isolated Arbitrary size All

More information

Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Cache Performance

Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Cache Performance 6.823, L11--1 Cache Performance and Memory Management: From Absolute Addresses to Demand Paging Asanovic Laboratory for Computer Science M.I.T. http://www.csg.lcs.mit.edu/6.823 Cache Performance 6.823,

More information

Virtual Memory: From Address Translation to Demand Paging

Virtual Memory: From Address Translation to Demand Paging Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November 12, 2014

More information

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

Lecture 21: Virtual Memory. Spring 2018 Jason Tang Lecture 21: Virtual Memory Spring 2018 Jason Tang 1 Topics Virtual addressing Page tables Translation lookaside buffer 2 Computer Organization Computer Processor Memory Devices Control Datapath Input Output

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 16: Memory Management and Paging Announcement Homework 2 is out To be posted on ilearn today Due in a week (the end of Feb 19 th ). 2 Recap: Fixed

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Spring 2018 Lecture 10: Paging Geoffrey M. Voelker Lecture Overview Today we ll cover more paging mechanisms: Optimizations Managing page tables (space) Efficient

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 29: an Introduction to Virtual Memory Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Virtual memory used to protect applications

More information

Recall: Address Space Map. 13: Memory Management. Let s be reasonable. Processes Address Space. Send it to disk. Freeing up System Memory

Recall: Address Space Map. 13: Memory Management. Let s be reasonable. Processes Address Space. Send it to disk. Freeing up System Memory Recall: Address Space Map 13: Memory Management Biggest Virtual Address Stack (Space for local variables etc. For each nested procedure call) Sometimes Reserved for OS Stack Pointer Last Modified: 6/21/2004

More information

EN1640: Design of Computing Systems Topic 06: Memory System

EN1640: Design of Computing Systems Topic 06: Memory System EN164: Design of Computing Systems Topic 6: Memory System Professor Sherief Reda http://scale.engin.brown.edu Electrical Sciences and Computer Engineering School of Engineering Brown University Spring

More information

CSE 560 Computer Systems Architecture

CSE 560 Computer Systems Architecture This Unit: CSE 560 Computer Systems Architecture App App App System software Mem I/O The operating system () A super-application Hardware support for an Page tables and address translation s and hierarchy

More information

Memory Hierarchy. Mehran Rezaei

Memory Hierarchy. Mehran Rezaei Memory Hierarchy Mehran Rezaei What types of memory do we have? Registers Cache (Static RAM) Main Memory (Dynamic RAM) Disk (Magnetic Disk) Option : Build It Out of Fast SRAM About 5- ns access Decoders

More information

Intel P The course that gives CMU its Zip! P6/Linux Memory System November 1, P6 memory system. Review of abbreviations

Intel P The course that gives CMU its Zip! P6/Linux Memory System November 1, P6 memory system. Review of abbreviations 15-213 The course that gives CMU its Zip! P6/Linux ory System November 1, 01 Topics P6 address translation Linux memory management Linux fault handling memory mapping Intel P6 Internal Designation for

More information

Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses.

Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses. Problem 9. VM address translation. (9 points): The following problem concerns the way virtual addresses are translated into physical addresses. The memory is byte addressable. Memory accesses are to 1-byte

More information

CS 61C: Great Ideas in Computer Architecture. Virtual Memory

CS 61C: Great Ideas in Computer Architecture. Virtual Memory CS 61C: Great Ideas in Computer Architecture Virtual Memory Instructor: Justin Hsia 7/30/2012 Summer 2012 Lecture #24 1 Review of Last Lecture (1/2) Multiple instruction issue increases max speedup, but

More information

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit.

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit. Memory Hierarchy Goal: Fast, unlimited storage at a reasonable cost per bit. Recall the von Neumann bottleneck - single, relatively slow path between the CPU and main memory. Fast: When you need something

More information

Intel P6 (Bob Colwell s Chip, CMU Alumni) The course that gives CMU its Zip! Memory System Case Studies November 7, 2007.

Intel P6 (Bob Colwell s Chip, CMU Alumni) The course that gives CMU its Zip! Memory System Case Studies November 7, 2007. class.ppt 15-213 The course that gives CMU its Zip! ory System Case Studies November 7, 07 Topics P6 address translation x86-64 extensions Linux memory management Linux fault handling ory mapping Intel

More information

V. Primary & Secondary Memory!

V. Primary & Secondary Memory! V. Primary & Secondary Memory! Computer Architecture and Operating Systems & Operating Systems: 725G84 Ahmed Rezine 1 Memory Technology Static RAM (SRAM) 0.5ns 2.5ns, $2000 $5000 per GB Dynamic RAM (DRAM)

More information

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck Main memory management CMSC 411 Computer Systems Architecture Lecture 16 Memory Hierarchy 3 (Main Memory & Memory) Questions: How big should main memory be? How to handle reads and writes? How to find

More information

CS399 New Beginnings. Jonathan Walpole

CS399 New Beginnings. Jonathan Walpole CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,

More information

Computer Science 146. Computer Architecture

Computer Science 146. Computer Architecture Computer Architecture Spring 2004 Harvard University Instructor: Prof. dbrooks@eecs.harvard.edu Lecture 18: Virtual Memory Lecture Outline Review of Main Memory Virtual Memory Simple Interleaving Cycle

More information