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

Similar documents
Virtual Memory Nov 9, 2009"

The cache is 4-way set associative, with 4-byte blocks, and 16 total lines

P6/Linux Memory System Nov 11, 2009"

Systems programming and Operating systems, 2005 Test Exam

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

Computer Systems. Virtual Memory. Han, Hwansoo

CSE 351. Virtual Memory

CS , Fall 2001 Exam 2

Part I: Pen & Paper Exercises, Cache

Virtual Memory. Samira Khan Apr 27, 2017

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

Virtual Memory Oct. 29, 2002

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory II. CSE 351 Autumn Instructor: Justin Hsia

CSE 153 Design of Operating Systems

Problem Page Possible Score Total 80

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

Question F5: Caching [10 pts]

CS , Fall 2001 Exam 2

Processes and Virtual Memory Concepts

CISC 360. Virtual Memory Dec. 4, 2008

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

VM as a cache for disk

CS , Spring 2002 Exam 2

CS , Fall 2003 Exam 2

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Systems programming and Operating systems, 2005 Tentamen

Virtual Memory III. CSE 351 Autumn Instructor: Justin Hsia

Virtual Memory: Concepts

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

UW CSE 351, Winter 2013 Final Exam

Memory System Case Studies Oct. 13, 2008

Virtual Memory: Systems

Pentium/Linux Memory System March 17, 2005

CS 333 Introduction to Operating Systems. Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University

CS 153 Design of Operating Systems

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

Virtual Memory II CSE 351 Spring

15-213: Final Exam Review

Virtual Memory: Concepts

ECE232: Hardware Organization and Design

Virtual Memory Overview

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

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

Virtual Memory: From Address Translation to Demand Paging

CS 153 Design of Operating Systems

Virtual Memory, Address Translation

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

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

Virtual Memory, Address Translation

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

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

Virtual Memory. Computer Systems Principles

Virtual Memory: Concepts

Virtual Memory: Systems

Foundations of Computer Systems

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 24

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

University of Washington Virtual memory (VM)

CSE351 Autumn 2010 Final Exam (December 13, 2010)

OS Extensibility: Spin, Exo-kernel and L4

Virtual Memory. Motivation:

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

Introduction to Computer Systems. Exam 2. April 11, Notes and calculators are permitted, but not computers.

Computer Structure. X86 Virtual Memory and TLB

Guerrilla 7: Virtual Memory, ECC, IO

CSE Computer Architecture I Fall 2011 Homework 07 Memory Hierarchies Assigned: November 8, 2011, Due: November 22, 2011, Total Points: 100

ECE 30 Introduction to Computer Engineering

CS 153 Design of Operating Systems

CS399 New Beginnings. Jonathan Walpole

Translation Buffers (TLB s)

University*of*Washington*

Virtual Memory Worksheet

CS 61 Section Notes 5

Chapter 10: Virtual Memory. Lesson 05: Translation Lookaside Buffers

CSE351 Autumn 2013 Final Exam (11 Dec 2013)

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

Pipelining Exercises, Continued

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

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

CSE351 Spring 2010 Final Exam (9 June 2010)

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568/668

ECE 2300 Digital Logic & Computer Organization. More Caches

6.004 Tutorial Problems L20 Virtual Memory

Computer Science 146. Computer Architecture

MEMORY: SWAPPING. Shivaram Venkataraman CS 537, Spring 2019

3. Address Translation (25 pts)

Cache Performance (H&P 5.3; 5.5; 5.6)

CSE351 Spring 2010 Final Exam (9 June 2010)

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

CSE 120 Principles of Operating Systems

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

ECE331 Homework 4. Due Monday, August 13, 2018 (via Moodle)

CS 537: Introduction to Operating Systems Fall 2016: Midterm Exam #1. All cell phones must be turned off and put away.

Lecture 19: Virtual Memory: Concepts

John Wawrzynek & Nick Weaver

Virtual Memory. Virtual Memory

Virtual Memory 2. q Handling bigger address spaces q Speeding translation

Las time: Large Pages Last time: VAX translation. Today: I/O Devices

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

Transcription:

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 words (not 4-byte words). Virtual addresses have the following fields: VPN: [15-9], VPO: [8-0], TLBT: [15-10], TLBI: [9] Physical addresses have following fields: PPN: [12-9], PPO: [8-0], CT: [12-5], CI: [4-2], CO: [1-0] The TLB is 8-way set associative with 16 total entries, as shown. The cache is 2-way set associative, with a 4 byte line size and 16 total lines. In the following tables, all numbers are given in hexadecimal. The contents of the TLB, the page table for the first 32 pages, and the cache are as follows: TLB Index Tag PPN Valid 0 09 4 1 12 2 1 10 0 1 08 5 1 05 7 1 13 1 0 10 3 0 18 3 0 1 04 1 0 0C 1 0 12 0 0 08 1 0 06 7 0 03 1 0 07 5 0 02 2 0 Page Table VPN PPN Valid VPN PPN Valid 00 6 1 10 0 1 01 5 0 11 5 0 02 3 1 12 2 1 03 4 1 13 4 0 04 2 0 14 6 0 05 7 1 15 2 0 06 1 0 16 4 0 07 3 0 17 6 0 08 5 1 18 1 1 09 4 0 19 2 0 0A 3 0 1A 5 0 0B 2 0 1B 7 0 0C 5 0 1C 6 0 0D 6 0 1D 2 0 0E 1 1 1E 3 0 0F 0 0 1F 1 0 2-way Set Associative Cache Index Tag Valid Byte 0 Byte 1 Byte 2 Byte 3 Tag Valid Byte 0 Byte 1 Byte 2 Byte 3 0 19 1 99 11 23 11 00 0 99 11 23 11 1 15 0 4F 22 EC 11 2F 1 55 59 0B 41 2 1B 1 00 02 04 08 0B 1 01 03 05 07 3 06 0 84 06 B2 9C 12 0 84 06 B2 9C 4 07 0 43 6D 8F 09 05 0 43 6D 8F 09 5 0D 1 36 32 00 78 1E 1 A1 B2 C4 DE 6 11 0 A2 37 68 31 00 1 BB 77 33 00 7 16 1 11 C2 11 33 1E 1 00 C0 0F 00 Page 11 of 16

For the given virtual address, indicate the TLB entry accessed, the physical address, and the cache byte value returned in hex. Indicate whether the TLB misses, whether a page fault occurs, and whether a cache miss occurs. If there is a cache miss, enter - for Cache Byte returned. If there is a page fault, enter - for PPN and leave parts C and D blank. Virtual address: 1DDE A. Virtual address format (one bit per box) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 B. Address translation VPN TLB Index TLB Tag TLB Hit? (Y/N) Page Fault? (Y/N) PPN C. Physical address format (one bit per box) 12 11 10 9 8 7 6 5 4 3 2 1 0 D. Physical memory reference Cache offset Cache Index Cache Tag Cache Hit? (Y/N) Cache Byte returned Page 12 of 16

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 words (not 4-byte words). Virtual addresses have the following fields: VPN: [15-9], VPO: [8-0], TLBT: [15-10], TLBI: [9] Physical addresses have following fields: PPN: [12-9], PPO: [8-0], CT: [12-5], CI: [4-2], CO: [1-0] The TLB is 8-way set associative with 16 total entries, as shown. The cache is 2-way set associative, with a 4 byte line size and 16 total lines. In the following tables, all numbers are given in hexadecimal. The contents of the TLB, the page table for the first 32 pages, and the cache are as follows: TLB Index Tag PPN Valid 0 09 4 1 12 2 1 10 0 1 08 5 1 05 7 1 13 1 0 10 3 0 18 3 0 1 04 1 0 0C 1 0 12 0 0 08 1 0 06 7 0 03 1 0 07 5 0 02 2 0 Page Table VPN PPN Valid VPN PPN Valid 00 6 1 10 0 1 01 5 0 11 5 0 02 3 1 12 2 1 03 4 1 13 4 0 04 2 0 14 6 0 05 7 1 15 2 0 06 1 0 16 4 0 07 3 0 17 6 0 08 5 1 18 1 1 09 4 0 19 2 0 0A 3 0 1A 5 0 0B 2 0 1B 7 0 0C 5 0 1C 6 0 0D 6 0 1D 2 0 0E 1 1 1E 3 0 0F 0 0 1F 1 0 2-way Set Associative Cache Index Tag Valid Byte 0 Byte 1 Byte 2 Byte 3 Tag Valid Byte 0 Byte 1 Byte 2 Byte 3 0 19 1 99 11 23 11 00 0 99 11 23 11 1 15 0 4F 22 EC 11 2F 1 55 59 0B 41 2 1B 1 00 02 04 08 0B 1 01 03 05 07 3 06 0 84 06 B2 9C 12 0 84 06 B2 9C 4 07 0 43 6D 8F 09 05 0 43 6D 8F 09 5 0D 1 36 32 00 78 1E 1 A1 B2 C4 DE 6 11 0 A2 37 68 31 00 1 BB 77 33 00 7 16 1 11 C2 11 33 1E 1 00 C0 0F 00 Page 11 of 16

For the given virtual address, indicate the TLB entry accessed, the physical address, and the cache byte value returned in hex. Indicate whether the TLB misses, whether a page fault occurs, and whether a cache miss occurs. If there is a cache miss, enter - for Cache Byte returned. If there is a page fault, enter - for PPN and leave parts C and D blank. Virtual address: 1DDE A. Virtual address format (one bit per box) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Answer: 0001 1101 1101 1110 B. Address translation VPN TLB Index TLB Tag TLB Hit? Page Fault? PPN 0E 0 07 N N 1 C. Physical address format (one bit per box) 12 11 10 9 8 7 6 5 4 3 2 1 0 Answer: 0 0011 1101 1110 D. Physical memory reference Cache offset Cache Index Cache Tag Cache Hit? Cache Byte returned 2 7 1E Y F Page 12 of 16

[20pts] 4. Oldie but Goodie The PDP11 was a series of computers sold by Digital Equipment Corp. (DEC) from 1970 and into the nineties. A PDP11 computer has a 16-bit virtual address space, where each address identifies a byte, for a total of 64 Kbytes. A page is 2 13 bytes = 8 Kbytes, and thus the virtual address space of a process consisted of 8 pages. A page table entry (PTE) had a 9- bit frame (= physical page) number, a Valid bit, and a Writable bit. a) [5pts] What is the maximum physical memory (in Kbytes) in a PDP11? (A Kbyte is 1024 bytes.) b) [9pts] Consider the following page table of a process: 0 yes 003 no 1 yes 001 no 2 yes 008 yes 3 no N/A N/A 4 no N/A N/A 5 no N/A N/A 6 no N/A N/A 7 yes 004 yes Fill in the following table: Virtual Address Valid (yes, no) Physical Address (if valid) in hexadecimals Writable (yes, no) 1234 4321 8888 c) [6pts] The Bogux O/S running on the PDP11 uses Local Replacement, meaning that it assigns a certain number of physical frames to each process. As a result, two processes never contend for the same frame. However, if a lot of processes are running, the number of frames per process may well be fewer than 8. Assume a situation in which each process has three frames. Suppose the page reference string of some process is 0, 7, 2, 0, 7, 1, 0, 3, 1, 2 Initially no pages are mapped to physical frames. Now consider the state of the process s page table after the first 7 references (i.e., after page accesses 0 7 2 0 7 1 0). Which (up to three) pages are mapped at this time assuming one of the following page replacement schemes, and how many page faults have occurred then. Also show in the last column how many page faults occur in total after all 10 references? Scheme all page numbers of mapped pages after 7 references (3 max.) #page faults after 7 references #page faults total (after 10 references) First In First Out (by way of example) 0 1 2 5 7 LRU (Least Recently Used) OPT (Belady) 8

[20pts] 4. Oldie but Goodie The PDP11 was a series of computers sold by Digital Equipment Corp. (DEC) from 1970 and into the nineties. A PDP11 computer has a 16-bit virtual address space, where each address identifies a byte, for a total of 64 Kbytes. A page is 2 13 bytes = 8 Kbytes, and thus the virtual address space of a process consisted of 8 pages. A page table entry (PTE) had a 9- bit frame (= physical page) number, a Valid bit, and a Writable bit. a) [5pts] What is the maximum physical memory (in Kbytes) in a PDP11? (A Kbyte is 1024 bytes.) b) [9pts] Consider the following page table of a process: 2 13+9 = 4,096 Kbytes 0 yes 003 no 1 yes 001 no 2 yes 008 yes 3 no N/A N/A 4 no N/A N/A 5 no N/A N/A 6 no N/A N/A 7 yes 004 yes Fill in the following table: Virtual Address Valid (yes, no) Physical Address (if valid) in hexadecimals Writable (yes, no) 1234 yes 07234 no 4321 yes 10321 yes 8888 no N/A no c) [6pts] The Bogux O/S running on the PDP11 uses Local Replacement, meaning that it assigns a certain number of physical frames to each process. As a result, two processes never contend for the same frame. However, if a lot of processes are running, the number of frames per process may well be fewer than 8. Assume a situation in which each process has three frames. Suppose the page reference string of some process is 0, 7, 2, 0, 7, 1, 0, 3, 1, 2 Initially no pages are mapped to physical frames. Now consider the state of the process s page table after the first 7 references (i.e., after page accesses 0 7 2 0 7 1 0). Which (up to three) pages are mapped at this time assuming one of the following page replacement schemes, and how many page faults have occurred then. Also show in the last column how many page faults occur in total after all 10 references? Scheme all page numbers of mapped pages after 7 references (3 max.) #page faults after 7 references #page faults total (after 10 references) First In First Out (by way of example) 0 1 2 5 7 LRU (Least Recently Used) OPT (Belady) 0 1 7 4 6 0 1 2 4 5 8