Page Which had internal designation P5

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

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

P6 memory system P6/Linux Memory System October 31, Overview of P6 address translation. Review of abbreviations. Topics. Symbols: ...

Pentium/Linux Memory System March 17, 2005

Memory System Case Studies Oct. 13, 2008

P6/Linux Memory System Nov 11, 2009"

Virtual Memory: Systems

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

Virtual Memory III /18-243: Introduc3on to Computer Systems 17 th Lecture, 23 March Instructors: Bill Nace and Gregory Kesden

Foundations of Computer Systems

Virtual Memory: Systems

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

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Operating Systems: Internals and Design. Chapter 8. Seventh Edition William Stallings

Virtual Memory. Samira Khan Apr 27, 2017

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

Virtual Memory Nov 9, 2009"

CS 153 Design of Operating Systems

Virtual Memory. Spring Instructors: Aykut and Erkut Erdem

Foundations of Computer Systems

Applications of. Virtual Memory in. OS Design

Virtual Memory Oct. 29, 2002

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

Virtual Memory II CSE 351 Spring

CSE 153 Design of Operating Systems

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

CSE 120 Principles of Operating Systems Spring 2017

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

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

PROCESS VIRTUAL MEMORY PART 2. CS124 Operating Systems Winter , Lecture 19

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 23

CSE 120 Principles of Operating Systems

CSE 351. Virtual Memory

Computer Systems. Virtual Memory. Han, Hwansoo

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 23

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

virtual memory Page 1 CSE 361S Disk Disk

CISC 360. Virtual Memory Dec. 4, 2008

Memory Management. Fundamentally two related, but distinct, issues. Management of logical address space resource

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

Virtual Memory: From Address Translation to Demand Paging

CIS Operating Systems Memory Management Cache and Demand Paging. Professor Qiang Zeng Spring 2018

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

CIS Operating Systems Memory Management Cache. Professor Qiang Zeng Fall 2015

CIS Operating Systems Memory Management Cache. Professor Qiang Zeng Fall 2017

Computer Architecture Lecture 13: Virtual Memory II

CS 3733 Operating Systems:

CS 318 Principles of Operating Systems

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

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

Computer Structure. X86 Virtual Memory and TLB

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

CS 153 Design of Operating Systems

Virtual Memory: From Address Translation to Demand Paging

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

Recap: Memory Management

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

ECEN 449 Microprocessor System Design. Review of C Programming. Texas A&M University

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

ECEN 449 Microprocessor System Design. Review of C Programming

Lecture 19: Virtual Memory: Concepts

Virtual Memory. Computer Systems Principles

Virtual Memory. Virtual Memory

CS 153 Design of Operating Systems Winter 2016

The course that gives CMU its Zip! I/O Nov 15, 2001

Paging. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

Paging. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

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

CSE 560 Computer Systems Architecture

Processes and Virtual Memory Concepts

ECE232: Hardware Organization and Design

Understanding the Design of Virtual Memory. Zhiqiang Lin

MMAP AND PIPE. UNIX Programming 2015 Fall by Euiseong Seo

Project 2! CSE 421/521 - Operating Systems! Virtual Memory in Pintos

Outline. 1 Details of paging. 2 The user-level perspective. 3 Case study: 4.4 BSD 1 / 19

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

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

Operating systems. Lecture 9

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

Virtual Memory I. CSE 351 Winter Instructor: Mark Wyse

Memory Mapping. Sarah Diesburg COP5641

CMSC 412 Project #4 Virtual Memory Due Friday April 11, 2014, at 5:00pm

CSCE 548 Building Secure Software Dirty COW Race Condition Attack

ECE 650 Systems Programming & Engineering. Spring 2018

Virtual Memory. CS 351: Systems Programming Michael Saelee

Virtual Memory: Concepts

Virtual Memory: Concepts

Virtual Memory I. CSE 351 Spring Instructor: Ruth Anderson

Virtual Memory - Objectives

Simple idea 1: load-time linking. Our main questions. Some terminology. Simple idea 2: base + bound register. Protection mechanics.

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

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1

Modeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems

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

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2015 Lecture 25

Virtual Memory Virtual memory first used to relive programmers from the burden of managing overlays.

Transcription:

Intel P6 Internal Designation for Successor to Pentium Which had internal designation P5 Fundamentally Different from Pentium 1 Out-of-order, superscalar operation Designed to handle server applications Requires high performance memory system Resulting Processors PentiumPro (1996) Pentium II (1997) Incorporated MMX instructions» special instructions for parallel processing L2 cache on same chip Pentium III (1999) Incorporated Streaming SIMD Extensions» More instructions for parallel processing P6 ory System 2 DRAM bus interface unit instruction fetch unit processor package external system bus (e.g. PCI) L2 cache cache bus i-cache inst d-cache bit address space 4 KB size, L2, and s 4-way set associative inst entries 8 sets 64 entries 16 sets i-cache and d-cache 16 KB B line size 8 sets L2 cache unified 8 KB -- 2 MB Review of Abbreviations Symbols: 3 Components of the I: index T: tag : virtual offset : virtual number Components of the PPO: offset (same as ) PPN: number CO: byte offset within cache line CI: cache index CT: cache tag Overview of P6 Address Translation 4 T I (16 sets, s L2 and DRAM (8 sets, 4 lines/set) 7 5 P6 2-level Table Structure 4-byte entries (s) that point to s one per process. must be in memory when its process is running s always pointed to by s: 5 4-byte entries (s) that point to s. s can be d in and out. Up to s s s s P6 Directory Entry () 6 31 11 9 8 7 6 5 4 3 2 1 0 base addr Avail G PS A CD WT U/S R/W P=1 base address: most significant bits of address (forces s to be 4KB aligned) Avail: These bits available for system programmers G: global (don t evict from on task switch) PS: size 4K (0) or 4M (1) A: accessed (set by MMU on reads and writes, cleared by software) CD: cache disabled (1) or enabled (0) WT: write-through or write-back cache policy for this U/S: user or supervisor mode access R/W: read-only or read-write access P: is present in memory (1) or not (0) 31 1 0 Available for OS ( location in secondary storage) P=0 1

P6 Table Entry () 31 11 9 8 7 6 5 4 3 2 1 0 base address Avail G 0 D A CD WT U/S R/W P=1 How P6 Tables Map Virtual Addresses to Physical Ones 10 1 10 2 Virtual address 7 base address: most significant bits of address (forces s to be 4 KB aligned) Avail: available for system programmers G: global (don t evict from on task switch) D: dirty (set by MMU on writes) A: accessed (set by MMU on reads and writes) CD: cache disabled or enabled WT: write-through or write-back cache policy for this U/S: user/supervisor R/W: read/write P: is present in memory (1) or not (0) 31 1 0 Available for OS ( location in secondary storage) P=0 8 address of address of base (if P=1) PPN address of base (if P=1) PPO and virtual Physical address Representation of Virtual Address Space 15 PT 3 14 13 Directory 11 PT 2 10 9 PT 0 8 7 6 Simplified Example Flags 9 16 virtual address space P: Is entry in memory? M: Has this part of VA space been mapped? 5 4 3 2 1 0 Addr Addr In On Unmapped P6 Translation 10 T I (16 sets, s (8 sets, 4 lines/set) 7 5 P6 entry (not all documented, so this is speculative): 11 / Tag PD V V: indicates a valid (1) or invalid (0) entry PD: is this entry a (1) or a (0)? 1 1 tag: disambiguates entries cached in the same set /: or entry Structure of the : 16 sets, 4 entries/set 16 entry entry entry entry set 0 entry entry entry entry set 1 entry entry entry entry set 2 entry entry entry entry set 15 Translating with the P6 virtual address T I 1 2 translation 3 address 4 1. Partition into T and I. 2. Is the for cached in set I? 3. Yes: then build address. 4. No: then read (and if not cached) from memory and build address. 2

P6 translation Translating with the P6 Tables (case 1/1) T I (16 sets, (8 sets, 4 lines/set) 7 5 p=1 p=1 Case 1/1: and present. MMU builds address and fetches word. OS action none 13 s 14 Translating with the P6 Tables (case 1/0) 15 p=1 p=0 Case 1/0: present but ing. fault exception handler receives the following args: VA that caused fault fault caused by non-present or -level protection violation read/write user/supervisor Translating with the P6 Tables (case 1/0, cont) 16 p=1 p=1 OS Action: Check for a legal virtual address. Read through. Find free (swapping out current if necessary) Read virtual from disk and copy to virtual Restart faulting instruction by returning from exception handler. Translating with the P6 Tables (case 0/1) 17 p=0 p=1 Case 0/1: ing but present. Introduces consistency issue. potentially every out requires update of disk. Linux disallows this if a is swapped out, then swap out its s too. Translating with the P6 Tables (case 0/0) 18 p=0 p=0 Case 0/0: and ing. fault exception 3

Translating with the P6 Tables (case 0/0, cont) p=1 p=0 OS action: swap in. restart faulting instruction by returning from handler. Like case 0/1 from here on. P6 Cache Access T I (16 sets, (8 sets, 4 lines/set) 7 5 19 s 21 Cache Access (8 sets, 4 lines/set) 7 5 Partition address into CO, CI, and CT. Use CT to determine if line containing word at address PA is cached in set CI. If no: check L2. If yes: extract word at byte offset CO and return to processor. Speeding Up Access Physical Observation virtual address (VA) 7 5 PPN Addr. Trans. PPO No Change CI Tag Check Bits that determine CI identical in virtual and address Can index into cache while address translation taking place Then check with CT from address Virtually indexed, ly tagged Cache carefully sized to make this possible 22 Linux Organizes VM as Collection of Areas task_struct 23 mm mm_struct pgd mmap pgd: address : read/write perions for this area shared with other processes or private to this process vm_area_struct process virtual memory shared libraries text 0x40000000 0x0804a0 0x08048000 0 Linux Fault Handling vm_area_struct r/o r/w 24 r/o process virtual memory shared libraries text 0 1 read 3 read 2 write Is the VA legal? i.e. is it in an area defined by a vm_area_struct? if not then signal segmentation violation (e.g. (1)) Is the operation legal? i.e., can the process read/write this area? if not then signal protection violation (e.g., (2)) If OK, handle fault e.g., (3) 4

ory Mapping Creation of new VM area done via memory mapping create new vm_area_struct and s for area area can be backed by (i.e., get its initial values from) : regular file on disk (e.g., an execu object file)» initial bytes come from a section of a file nothing (e.g., bss)» initial bytes are zeros dirty s are swapped back and forth between a special swap file. Key point: no virtual s are copied into memory until they are referenced! known as demand paging crucial for time and space efficiency User-Level ory Mapping void *mmap(void *start, int len, int prot, int flags, int fd, int offset) map len bytes starting at offset offset of the file specified by file description fd, preferably at address start (usually 0 for don t care). prot: MAP_READ, MAP_WRITE flags: MAP_PRIVATE, MAP_SHARED return a pointer to the mapped area. Example: fast file copy useful for applications like Web servers that need to quickly copy files. mmap allows file transfers without copying into user space. 25 26 mmap() Example: Fast File Copy #include <unistd.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> /* * mmap.c - a program that uses mmap * to copy itself to stdout */ 27 int main() { struct stat stat; int i, fd, size; char *bufp; /* open the file & get its size*/ fd = open("./mmap.c", O_RDONLY); fstat(fd, &stat); size = stat.st_size; /* map the file to a new VM area */ bufp = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0); /* write the VM area to stdout */ write(1, bufp, size); } ory System Summary Cache ory Purely a speed-up technique Behavior invisible to application programmer and OS Implemented totally in hardware Virtual ory 28 Supports many OS-related functions Process creation» Initial» Forking children Task switching Protection Combination of hardware & software implementation Software management of s, allocations Hardware access of s Hardware caching of entries () 5