EECS 370 Discussion 1 SMBC. EECS 370 Discussion Exam 2 Solutions posted online Will be returned in next discussion (12/9) – Grades hopefully up on CTools.

Slides:



Advertisements
Similar presentations
EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
Advertisements

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.
COMP 3221: Microprocessors and Embedded Systems Lectures 27: Virtual Memory - III Lecturer: Hui Wu Session 2, 2005 Modified.
1 Lecture 20: Cache Hierarchies, Virtual Memory Today’s topics:  Cache hierarchies  Virtual memory Reminder:  Assignment 8 will be posted soon (due.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley and Rabi Mahapatra & Hank Walker.
Computer ArchitectureFall 2008 © November 10, 2007 Nael Abu-Ghazaleh Lecture 23 Virtual.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
1 Lecture 14: Virtual Memory Today: DRAM and Virtual memory basics (Sections )
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
11/10/2005Comp 120 Fall November 10 8 classes to go! questions to me –Topics you would like covered –Things you don’t understand –Suggestions.
CS 241 Section Week #12 (04/22/10).
Review of Memory Management, Virtual Memory CS448.
Some VM Complications Extra memory accesses Page tables are huge
Lecture 19: Virtual Memory
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Operating Systems ECE344 Ding Yuan Paging Lecture 8: Paging.
IT253: Computer Organization
Lecture Topics: 11/17 Page tables TLBs Virtual memory flat page tables
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP 203 / NWEN 201 Computer Organisation / Computer Architectures Virtual.
Virtual Memory Expanding Memory Multiple Concurrent Processes.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
The Three C’s of Misses 7.5 Compulsory Misses The first time a memory location is accessed, it is always a miss Also known as cold-start misses Only way.
Ch7d- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Individual Space Every process wants its own space Ideally, it would like.
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
Virtual Memory. Virtual Memory: Topics Why virtual memory? Virtual to physical address translation Page Table Translation Lookaside Buffer (TLB)
Malloc & VM By sseshadr. Agenda Administration – Process lab code will be inked by Thursday (pick up in ECE hub) – Malloc due soon (Thursday, November.
1 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?
Chapter 91 Logical Address in Paging  Page size always chosen as a power of 2.  Example: if 16 bit addresses are used and page size = 1K, we need 10.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Introduction to Virtual Memory and Memory Management
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
ICOM Noack Memory management Virtual memory Paging and segmentation Demand paging Memory management hardware.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
Lab4: Virtual Memory CS 3410 : Computer System Organization & Programming Spring 2015.
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)
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
CS203 – Advanced Computer Architecture Virtual Memory.
Computer Architecture Recitation 3 Presenter: Kevin Chang Prof. Onur Mutlu Carnegie Mellon University Spring 2015, 3/16/2015.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
Lecture 11 Virtual Memory
CS161 – Design and Architecture of Computer
Lecture 12 Virtual Memory.
Lecture Topics: 11/19 Paging Page tables Memory protection, validation
A Real Problem What if you wanted to run a program that needs more memory than you have? September 11, 2018.
CS703 - Advanced Operating Systems
Section 9: Virtual Memory (VM)
Today How was the midterm review? Lab4 due today.
CSCI206 - Computer Organization & Programming
Chapter 8 Digital Design and Computer Architecture: ARM® Edition
Replacement Policies Assume all accesses are: Cache Replacement Policy
FIGURE 12-1 Memory Hierarchy
Page that info back into your memory!
Lecture 29: Virtual Memory-Address Translation
Virtual Memory فصل هشتم.
Translation Lookaside Buffer
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
TLB Performance Seung Ki Lee.
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CS 3410, Spring 2014 Computer Science Cornell University
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
4.3 Virtual Memory.
CS 444/544 Operating Systems II Virtual Memory Translation
Virtual Memory 1 1.
Presentation transcript:

EECS 370 Discussion 1 SMBC

EECS 370 Discussion Exam 2 Solutions posted online Will be returned in next discussion (12/9) – Grades hopefully up on CTools earlier 2

EECS 370 Discussion Roadmap to end of semester Homework 7 – Thursday 12/5 Project 4 – Friday 12/6 Final Exam – Monday 12/16 10:30 am – 12:30 pm make sure you don’t have a conflict… 3

EECS 370 Discussion Project 4 – Overview – Tips – Example Virtual Memory – Motivation – Page Tables – Translation Lookaside Buffer – Hierarchical Page Table 4

EECS 370 Discussion Project 4 Start from correct P1 code - remove printstate() - add printaction() What are the three times you access memory? 5

EECS 370 Discussion Project 4 Start from correct P1 code - remove printstate() - add printaction() What are the three times you access memory? LW, SW, and Fetch 6

EECS 370 Discussion Project 4 Implement an arbitrary cache - 2D array of structs, perhaps Possible Function Prototypes: int load(int address) void store(int address, int data) 7

EECS 370 Discussion Project 4 transferring word [0-3] from the memory to the cache transferring word [0-0] from the cache to the processor transferring word [4-7] from the memory to the cache transferring word [6-6] from the processor to the cache transferring word [1-1] from the cache to the processor transferring word [4-7] from the cache to the memory transferring word [20-23] from the memory to the cache transferring word [23-23] from the cache to the processor transferring word [2-2] from the cache to the processor transferring word [20-23] from the cache to nowhere transferring word [28-31] from the memory to the cache transferring word [30-30] from the cache to the processor transferring word [3-3] from the cache to the processor 8 sw lw lw halt Fetch SW LW Cache Miss Fetch Cache Miss Eviction (dirty) Eviction (clean)

EECS 370 Discussion Virtual Memory Virtual Addresses map to Physical Addresses Software sees: Hardware sees: 9

EECS 370 Discussion Virtual Memory Virtual Addresses map to Physical Addresses Software sees: Virtual Addresses Hardware sees: Physical Addresses 10

EECS 370 Discussion Virtual Memory Motivation - Efficiency 11 Address Space 0x0 0xFF Program 1 Program 2 Program 3

EECS 370 Discussion Virtual Memory Motivation - Efficiency 12 Address Space 0x0 0xFF Program 1 Program 2 Program 3 Program 1

EECS 370 Discussion Virtual Memory Motivation - Efficiency 13 Address Space 0x0 0xFF Program 1 Program 2 Program 3 Program 1 Program 2

EECS 370 Discussion Virtual Memory Motivation - Efficiency 14 Address Space 0x0 0xFF Program 1 Program 2 Program 3 Program 2

EECS 370 Discussion Virtual Memory Motivation - Efficiency 15 Address Space 0x0 0xFF Program 1 Program 2 Program 3 Program 2 Program 3

EECS 370 Discussion Virtual Memory Motivation - Efficiency 16 Address Space 0x0 0xFF Program 1 Program 2 Program 3 Program 2 Program 3 Wasted Space

EECS 370 Discussion Virtual Memory Motivation - Efficiency 17 Address Space 0x0 0xFF Program 2 Program 3 Wasted Space This wouldn’t happen if we could split up programs into smaller chunks

EECS 370 Discussion Virtual Memory Motivation - Size 18 Address Space 0x0 0xFF Program 1

EECS 370 Discussion Virtual Memory Motivation - Size 19 Programs bigger than main memory simply can’t be run? How do I play Civ 5 then? (6.98 GB) Address Space 0x0 0xFF

EECS 370 Discussion Virtual Memory Motivation - Security 20 Program 1 (Operating System) Program 2 (Written by you) Address Space 0x0 0xFF Program 1 Program 2

EECS 370 Discussion Virtual Memory Motivation - Security 21 Program 1 (Operating System) Program 2 (Written by you) Address Space 0x0 0xFF Program 1 Program 2 Writes to memory…

EECS 370 Discussion Virtual Memory Motivation - Security 22 Program 1 (Operating System) Program 2 (Written by you) Address Space 0x0 0xFF Program 1 Program 2 Writes to memory… Crashes

EECS 370 Discussion Virtual Memory Solution: Program is split into smaller chunks (pages) Virtual Addresses map to where page is actually stored Could be Main Memory or Disk Memory acts like a cache for the disk 23

EECS 370 Discussion Virtual Memory Motivation - Efficiency 24 Address Space 0x0 0xFF Program 1 Program 2 Program 3 Program 2 Program 3 Wasted Space Part of Program 1

EECS 370 Discussion Virtual Memory Motivation - Size 25 Address Space 0x0 0xFF Program 1 (1/4) Program 1 (2/4) Program 1 (3/4) Program 1 (1/4) Program 1 (2/4) Program 1 (3/4) Program 1 (4/4)

EECS 370 Discussion Virtual Memory Motivation - Size 26 Address Space 0x0 0xFF Program 1 (1/4) Program 1 (4/4) Program 1 (3/4) Program 1 (1/4) Program 1 (2/4) Program 1 (3/4) Program 1 (4/4)

EECS 370 Discussion Virtual Memory We can also protect memory Check addresses during translation only allow writes from the correct programs Mark entire pages as read-only 27

EECS 370 Discussion Virtual Memory Page Table Data Structure for address translation Indexed by Virtual Page Number Each entry has Physical Page Number Valid Bit Dirty Bit LRU Policy for evictions 28

EECS 370 Discussion Virtual Memory Page Table is usually stored in Main Memory What’s the problem here? 29

EECS 370 Discussion Virtual Memory Page Table is usually stored in Main Memory What’s the problem here? Two memory accesses per memory access SUPER SLOW! 30

EECS 370 Discussion Virtual Memory Solution: Translation Lookaside Buffer (TLB) special cache for Page Table entries only 31

EECS 370 Discussion Virtual Memory TLB Hit 32 Translation Lookaside Buffer Virtual Page Number Physical Page Number Page Table Data Processor Main Memory Physical Page Number

EECS 370 Discussion Virtual Memory TLB Hit 33 Translation Lookaside Buffer Virtual Page Number Page Table Data Processor Main Memory Physical Page Number Data

EECS 370 Discussion Virtual Memory Hierarchical Page Tables: Page Table points to locations of other Page Tables Bottom level points to actual Physical Address Uses much less space on average Uses much more space at worst 34

EECS 370 Discussion Virtual Memory 35 Superpage Table Subpage Table Physical Address Subpage Table Physical Address Subpage Table Physical Address