Review What are the advantages/disadvantages of pages versus segments?

Slides:



Advertisements
Similar presentations
1 Memory hierarchy and paging Electronic Computers M.
Advertisements

EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
Spring 2003CSE P5481 Introduction Why memory subsystem design is important CPU speeds increase 55% per year DRAM speeds increase 3% per year rate of increase.
CSCE 212 Chapter 7 Memory Hierarchy Instructor: Jason D. Bakos.
Paging and Virtual Memory. Memory management: Review  Fixed partitioning, dynamic partitioning  Problems Internal/external fragmentation A process can.
Translation Buffers (TLB’s)
Virtual Memory and Paging J. Nelson Amaral. Large Data Sets Size of address space: – 32-bit machines: 2 32 = 4 GB – 64-bit machines: 2 64 = a huge number.
Mem. Hier. CSE 471 Aut 011 Evolution in Memory Management Techniques In early days, single program run on the whole machine –Used all the memory available.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
Topics covered: Memory subsystem CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Computer Architecture Lecture 28 Fasih ur Rehman.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Virtual Memory Part 1 Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology May 2, 2012L22-1
Virtual Memory 1 1.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
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)
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
CS203 – Advanced Computer Architecture Virtual Memory.
Memory Management memory hierarchy programs exhibit locality of reference - non-uniform reference patterns temporal locality - a program that references.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
CMSC 611: Advanced Computer Architecture
Lecture 11 Virtual Memory
Virtual Memory Chapter 7.4.
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
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.
ECE/CS 552: Virtual Memory
Some Real Problem What if a program needs more memory than the machine has? even if individual programs fit in memory, how can we run multiple programs?
IT 251 Computer Organization and Architecture
Memory Hierarchy Virtual Memory, Address Translation
Morgan Kaufmann Publishers
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 2018
Virtual Memory Chapter 8.
Evolution in Memory Management Techniques
Translation Lookaside Buffer
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Translation Buffers (TLB’s)
Virtual Memory Overcoming main memory size limitation
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
© 2004 Ed Lazowska & Hank Levy
CSE451 Virtual Memory Paging Autumn 2002
CSE 451: Operating Systems Autumn 2004 Page Tables, TLBs, and Other Pragmatics Hank Levy 1.
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Computer Architecture
CSE 471 Autumn 1998 Virtual memory
Evolution in memory management techniques
CSE 451: Operating Systems Winter 2005 Page Tables, TLBs, and Other Pragmatics Steve Gribble 1.
CSE 153 Design of Operating Systems Winter 2019
Evolution in memory management techniques
Evolution in memory management techniques
Virtual Memory Lecture notes from MKP and S. Yalamanchili.
Translation Buffers (TLBs)
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.
Synonyms v.p. x, process A v.p # index Map to same physical page
Virtual Memory 1 1.
Presentation transcript:

Review What are the advantages/disadvantages of pages versus segments? 7/29/2019 CSE378 Virtual Mem. Impl.

Review What are the advantages/disadvantages of pages versus segments? What information does a page table entry (PTE) contain? Be complete. 7/29/2019 CSE378 Virtual Mem. Impl.

Review What are the advantages/disadvantages of pages versus segments? What information does a page table entry (PTE) contain? Be complete. Every address, virtual or physical, is composed of two parts; what are they? 7/29/2019 CSE378 Virtual Mem. Impl.

Review What are the advantages/disadvantages of pages versus segments? What information does a page table entry (PTE) contain? Be complete. Every address, virtual or physical, is composed of two parts; what are they? In caching terms, what is the main memory? 7/29/2019 CSE378 Virtual Mem. Impl.

Review What are the advantages/disadvantages of pages versus segments? What information does a page table entry (PTE) contain? Be complete. Every address, virtual or physical, is composed of two parts; what are they? In caching terms, what is the main memory? On a L1 cache miss, the processor stalls, but on a page fault (page miss) it switches context. Why? 7/29/2019 CSE378 Virtual Mem. Impl.

Review What are the advantages/disadvantages of pages versus segments? What information does a page table entry (PTE) contain? Be complete. Every address, virtual or physical, is composed of two parts; what are they? In caching terms, what is the main memory? On a L1 cache miss, the processor stalls, but on a page fault (page miss) it switches context. Why? Paging, VM, demand loading are interacting ideas; explain each. 7/29/2019 CSE378 Virtual Mem. Impl.

Translation Buffers (TLBs) To perform virtual to physical address translation we need to look-up a page table entry Since the page table is in memory, need to access memory Much too time consuming; 50 cycles or more per memory reference Hence we need to cache the page tables For that purpose special caches named translation buffers are part of the memory system Also named Translation Lookaside Buffers (TLBs) 7/29/2019 CSE378 Virtual Mem. Impl.

TLB organization TLB organized as caches Therefore for each entry in the TLB we’ll have a tag to check that it is the right entry data which instead of being the contents of memory locations, like in a cache, will be a page table entry (PTE) TLB’s are smaller than memory caches 32 to 128 entries from fully associative to direct-mapped there can be an instruction TLB, a data TLB and also distinct TLB’s for user and system address spaces 7/29/2019 CSE378 Virtual Mem. Impl.

TLB organization Virtual page number Offset tag Index Copy of PTE v d prot Physical frame number 7/29/2019 CSE378 Virtual Mem. Impl.

From virtual address to memory location (highly abstracted; revisited) ALU hit Virtual address cache miss miss TLB Main memory hit Physical address Why is it called a translation lookaside buffer? 7/29/2019 CSE378 Virtual Mem. Impl.

Address translation At each memory reference the hardware searches the TLB for the translation TLB hit and valid PTE the physical address is passed to the cache TLB miss, either hardware or software (depends on implementation) searches page table in memory. If PTE is valid, contents of the PTE loaded in the TLB and back to step above In hardware the TLB miss takes 10-100 cycles In software takes up to 100 -1000 cycles In either case, no context-switch Context-switch takes more cycles than a TLB miss If PTE is invalid, we have a page fault (even on a TLB hit) 7/29/2019 CSE378 Virtual Mem. Impl.

TLB Management TLBs are organized as caches MIPS 3000 TLB (old) If small, can be fully associative Current trend: larger (about 128 entries); separate TLB’s for instruction and data; Some part of the TLB reserved for system TLBs are write-back. The only thing that can change is dirty bit + any other information needed for page replacement algorithm (cf. CSE 451) MIPS 3000 TLB (old) 64 entries: fully associative. “Random” replacement; 8 entries used by system On TLB miss, we have a trap; software takes over but no context-switch 7/29/2019 CSE378 Virtual Mem. Impl.

TLB management (continued) At context-switch, the virtual page translations in the TLB are not valid for the new task Invalidate the TLB (set all valid bits to 0) Or append a Process ID (PID) number to the tag in the TLB. When a new task takes over, the O.S. creates a new PID. PID are recycled and entries corresponding to “old PID” are invalidated. 7/29/2019 CSE378 Virtual Mem. Impl.

Paging systems -- Hardware/software interactions Page tables Managed by the O.S. Address of the start of the page table for a given process is found in a special register which is part of the state of the process The O.S. has its own page table The O.S. knows where the pages are stored on disk Page fault When a program attempts to access a location which is part of a page that is not in main memory, we have a page fault 7/29/2019 CSE378 Virtual Mem. Impl.

Page fault detection (simplified) Page fault is an exception Detected by the hardware (invalid bit in PTE either in TLB or page table) To resolve a page fault takes millions of cycles (disk I/O) The program that has a page fault must be interrupted A page fault occurs in the middle of an instruction In order to restart the program later, the state of the program must be saved and instructions must be restartable (precise exceptions) State consists of all registers, including PC and special registers (such as the one giving the start of the page table address) 7/29/2019 CSE378 Virtual Mem. Impl.

Page fault handler (simplified) Page fault exceptions are cleared by an O.S. routine called the page fault handler which will Grab a physical frame from a free list maintained by the O.S. Find out where the faulting page resides on disk Initiate a read for that page Choose a frame to free (if needed), i.e., run a replacement algorithm If the replaced frame is dirty, initiate a write of that frame to disk Context-switch, i.e., give the CPU to a task ready to proceed 7/29/2019 CSE378 Virtual Mem. Impl.

Completion of page fault When the faulting page has been read from disk (a few ms later) The disk controller will raise an interrupt (another form of exception) The O.S. will take over (context-switch) and modify the PTE (in particular, make it valid) The program that had the page fault is put on the queue of tasks ready to be run Context-switch to the program that was running before the interrupt occurred 7/29/2019 CSE378 Virtual Mem. Impl.

Two extremes in the memory hierarchy 7/29/2019 CSE378 Virtual Mem. Impl.

Other extreme differences Mapping: Restricted (L1) vs. General (Paging) Hardware assist for virtual address translation (TLB) Miss handler Hardware only for caches Software only for paging system (context-switch) Hardware and/or software for TLB Replacement algorithm Not that important for caches Very important for paging system Write policy Always write back for paging systems 7/29/2019 CSE378 Virtual Mem. Impl.

Some optimizations Speed-up of the most common case (TLB hit + L1 Cache hit) Do TLB look-up and cache look-up in parallel possible if cache index independent of virtual address translation (good only for small caches) Have cache indexed by virtual addresses but with physical tags Have cache indexed by virtual addresses but with virtual tags these last two solutions have additional problems referred to as synonyms 7/29/2019 CSE378 Virtual Mem. Impl.