CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.

Slides:



Advertisements
Similar presentations
Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
Advertisements

Fabián E. Bustamante, Spring 2007
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
CSIE30300 Computer Architecture Unit 10: Virtual Memory Hsin-Chou Chi [Adapted from material by and
Virtual Memory Hardware Support
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
C SINGH, JUNE 7-8, 2010IWW 2010, ISATANBUL, TURKEY Advanced Computers Architecture, UNIT 2 Advanced Computers Architecture Virtual Memory By Rohit Khokher.
CSE 490/590, Spring 2011 CSE 490/590 Computer Architecture Virtual Memory I Steve Ko Computer Sciences and Engineering University at Buffalo.
Virtual Memory Oct. 21, 2003 Topics Motivations for VM Address translation Accelerating translation with TLBs class17.ppt “The course that gives.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
CS 61C L24 VM II (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures.
Virtual Memory Nov 27, 2007 Slide Source: Topics Motivations for VM Address translation Accelerating translation with TLBs class12.ppt.
Virtual Memory.
S.1 Review: The Memory Hierarchy Increasing distance from the processor in access time L1$ L2$ Main Memory Secondary Memory Processor (Relative) size of.
Virtual Memory October 2, 2000
Virtual Memory Topics Motivations for VM Address translation Accelerating translation with TLBs CS213.
Virtual Memory October 30, 2001 Topics Motivations for VM Address translation Accelerating translation with TLBs class19.ppt “The course that gives.
CS61C L33 Virtual Memory I (1) Garcia, Fall 2006 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c UC Berkeley.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
Memory: Virtual MemoryCSCE430/830 Memory Hierarchy: Virtual Memory CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng Zhu.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 33 – Virtual Memory I OCZ has released a 1 TB solid state drive (the biggest.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 34 – Virtual Memory II Researchers at Stanford have developed “nanoscale.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
Virtual Memory May 19, 2008 Topics Motivations for VM Address translation Accelerating translation with TLBs EECS213.
Virtual Memory Topics Motivations for VM Address translation Accelerating translation with TLBs CS 105 “Tour of the Black Holes of Computing!”
CSE431 L22 TLBs.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 22. Virtual Memory Hardware Support Mary Jane Irwin (
Lecture 19: Virtual Memory
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
Virtual Memory Part 1 Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology May 2, 2012L22-1
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Virtual Memory March 23, 2000 Topics Motivations for VM Address translation Accelerating address translation with TLBs Pentium II/III memory system
Review (1/2) °Caches are NOT mandatory: Processor performs arithmetic Memory stores data Caches simply make data transfers go faster °Each level of memory.
Virtual Memory April 3, 2001 Topics Motivations for VM Address translation Accelerating translation with TLBs class20.ppt.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
University of Amsterdam Computer Systems – virtual memory Arnoud Visser 1 Computer Systems Virtual Memory.
Virtual Memory Additional Slides Slide Source: Topics Address translation Accelerating translation with TLBs class12.ppt.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Virtual Memory.  Next in memory hierarchy  Motivations:  to remove programming burdens of a small, limited amount of main memory  to allow efficient.
CS.305 Computer Architecture Memory: Virtual Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly made available.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
CS 105 “Tour of the Black Holes of Computing!”
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
Constructive Computer Architecture Virtual Memory: From Address Translation to Demand Paging Arvind Computer Science & Artificial Intelligence Lab. Massachusetts.
Virtual Memory CS740 October 13, 1998 Topics page tables TLBs Alpha 21X64 memory system.
1 Virtual Memory. 2 Outline Virtual Space Address translation Accelerating translation –with a TLB –Multilevel page tables Different points of view Suggested.
3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.
CS203 – Advanced Computer Architecture Virtual Memory.
Lecture 11 Virtual Memory
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
Virtual Memory User memory model so far:
From Address Translation to Demand Paging
CS703 - Advanced Operating Systems
Section 9: Virtual Memory (VM)
CS 704 Advanced Computer Architecture
Virtual Memory.
CS 105 “Tour of the Black Holes of Computing!”
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
CS 105 “Tour of the Black Holes of Computing!”
Page that info back into your memory!
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Virtual Memory Nov 27, 2007 Slide Source:
Translation Buffers (TLB’s)
Translation Buffers (TLB’s)
CS 105 “Tour of the Black Holes of Computing!”
CS 105 “Tour of the Black Holes of Computing!”
CS703 - Advanced Operating Systems
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Virtual Memory.
Presentation transcript:

CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics Arizona State University Slides courtesy: Prof. Yann Hang Lee, ASU, Prof. Mary Jane Irwin, PSU, Ande Carle, UCB

CML CMLAnnouncements This Lecture: Review, Virtual Memory Finals –Tuesday, Dec 08, 2009 –Please come on time (You’ll need all the time) –Open book, notes, and internet –No communication with any other human

CML CML Course Objectives Understand MIPS assembly language, and write assembly language programs for simple problems, including function calls. Understand the data representation (2’s complement, single and double precision float point) inside the processor, and perform arithmetic operations on them. Understand the working of a single-cycle, and pipelined processor, including basic schemes of hazard detection and avoidance. Understand the rationale behind the memory organization, and know how caches operate. Introduction to multi-cores

CML CML Other Aspects of the course Get the key point of the lecture Stimulate thinking Relate course material to outside world Grading as “carrot” and not as “stick”

CML CML Feedback for the next generation Attendance Project deadlines Quizzes, Midterms and Finals Assignments Lectures Other issues?

CML CML Time, Time, Time Making a Single Cycle Implementation is very easy –Difficulty and excitement is in making it fast Two fundamental methods to make Computers fast –Pipelining –Caches Parallelism –Multi-tasking AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data

CML CML Virtual Memory How to run two programs simultaneously? Physical memory Size –What if I have less than 2^32 size memory? –Can I use more than 2^32 size memory? Some basic protection mechanisms –One program can overwrite instructions of Operating System functions.

CML CML Motivation 1: DRAM a “Cache” for Disk The full address space is quite large: –32-bit addresses: ~4,000,000,000 (4 billion) bytes –64-bit addresses: ~16,000,000,000,000,000,000 (16 quintillion) bytes Disk storage is ~30X cheaper than DRAM storage –8 GB of DRAM: ~ $12,000 –8 GB of disk: ~ $400 To access large amounts of data in a cost-effective manner, the bulk of the data must be stored on disk 8 GB: ~$ MB: ~$400 4 MB: ~$400 DiskDRAMSRAM

CML CML Motivation #2: Memory Management Multiple processes can reside in physical memory. How do we resolve address conflicts? Reserved Text (Code) Static Data Not yet allocated Stack Dynamic Data FF Reserved Not yet allocated $gp $sp e.g., what if two different Alpha processes access their stacks at address 0x11fffff80 at the same time? (Virtual) Memory Image for Alpha Process

CML CML Process 1: Virtual AddressesPhysical Addresses VP 1 VP 2 Process 2: PP 2 Address Translation 0 0 N-1 0 M-1 VP 1 VP 2 PP 7 PP 10 (Read-only library code) Soln: Separate Virtual Addr. Spaces –Virtual and physical address spaces divided into equal-sized blocks “Pages” (both virtual and physical) –Each process has its own virtual address space operating system controls how virtual pages as assigned to physical memory

CML CML Motivation #3: Protection Page table entry contains access rights information –hardware enforces this protection (trap into OS if violation occurs) Page Tables Process i: Physical AddrRead?Write? PP 9YesNo PP 4Yes XXXXXXX No VP 0: VP 1: VP 2: Process j: 0: 1: N-1: Memory Physical AddrRead?Write? PP 6Yes PP 9YesNo XXXXXXX No VP 0: VP 1: VP 2:

CML CML VM Address Translation V = {0, 1,..., N–1} virtual address space P = {0, 1,..., M–1} physical address space MAP: V  P U {  } address mapping function N > M MAP(a) = a' if data at virtual address a is present at physical address a' in P =  if data at virtual address a is not present in P Processor Addr Trans Mechanism fault handler Main Memory Secondary memory a a'  missing item fault physical address OS performs this transfer (only if miss)

CML CML virtual page numberpage offset virtual address physical page numberpage offset physical address 0p–1 address translation pm–1 n–10p–1p Notice that the page offset bits don't change as a result of translation VM Address Translation Parameters –P = 2 p = page size (bytes). Typically 1KB–16KB –N = 2 n = Virtual address limit –M = 2 m = Physical address limit

CML CML Page Tables Page Table (physical page or disk address) Physical Memory Disk Storage Valid Virtual Page Number

CML CML Address Translation via Page Table virtual page numberpage offset virtual address physical page numberpage offset physical address 0p–1pm–1 n–10p–1p page table base register if valid=0 then page not in memory valid physical page number access VPN acts as table index Address

CML CML Page Table Operation Translation –Separate (set of) page table(s) per process –VPN forms index into page table Computing Physical Address –Page Table Entry (PTE) provides information about page if (Valid bit = 1) then page in memory. –Use physical page number (PPN) to construct address if (Valid bit = 0) then page in secondary memory –Page fault –Must load into main memory before continuing Checking Protection –Access rights field indicate allowable access e.g., read-only, read-write, execute-only typically support multiple protection modes (e.g., kernel vs. user) –Protection violation fault if don’t have necessary permission

CML CML CPU Trans- lation Cache Main Memory VAPA miss hit data Integrating VM and Cache Most Caches “Physically Addressed” –Accessed by physical addresses –Allows multiple processes to have blocks in cache at same time –Allows multiple processes to share pages –Cache doesn’t need to be concerned with protection issues Access rights checked as part of address translation Perform Address Translation Before Cache Lookup –But this could involve a memory access itself –Of course, page table entries can also become cached

CML CML CPU TLB Lookup Cache Main Memory VAPA miss hit data Trans- lation hit miss Speeding up Translation with a TLB “Translation Lookaside Buffer” (TLB) –Small, usually fully associative cache –Maps virtual page numbers to physical page numbers –Contains complete page table entries for small number of pages

CML CML Address Translation with a TLB virtual address virtual page number page offset physical address N–10p–1p validphysical page numbertag valid dirty valid tagdata = cache hit tagbyte offset index = TLB hit process ID TLB Cache

CML CML Yoda says… May the Force be with you