Chapter VIII Virtual Memory Review Questions Jehan-François Pâris

Slides:



Advertisements
Similar presentations
Page Table Implementation
Advertisements

Chapter 8 Homework Solutions
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
COSC 3330/6308 Solutions to Second Problem Set Jehan-François Pâris October 2012.
1 Virtual Memory Management B.Ramamurthy. 2 Demand Paging Main memory LAS 0 LAS 1 LAS 2 (Physical Address Space -PAS) LAS - Logical Address.
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Chapter VIII Virtual Memory Jehan-François Pâris
CSC 4250 Computer Architectures December 8, 2006 Chapter 5. Memory Hierarchy.
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Memory Management (II)
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Memory Management -3 CS 342 – Operating Systems Ibrahim Korpeoglu Bilkent.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Virtual Memory Review CSE 121 Spring 2003 Keith Marzullo.
Memory Management and Paging CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Memory Problems Prof. Sin-Min Lee Department of Mathematics and Computer Sciences.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
Virtual Memory Chapter 8.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
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.
Virtual Memory Management B.Ramamurthy. Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
Answers to the VM Problems Spring First question A computer has 32 bit addresses and a virtual memory with a page size of 8 kilobytes.  How many.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
CS 241 Section Week #12 (04/22/10).
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
Operating Systems Chapter 8
Problems discussed in the review session for the final COSC 4330/6310 Summer 2012.
Lecture 19: Virtual Memory
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Virtual Memory 1 1.
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.
4.3 Virtual Memory. Virtual memory  Want to run programs (code+stack+data) larger than available memory.  Overlays programmer divides program into pieces.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Demand Paging Reference Reference on UNIX memory management
Homework Assignment #3 J. H. Wang Nov. 13, 2015.
1  2004 Morgan Kaufmann Publishers Chapter Seven Memory Hierarchy-3 by Patterson.
Page Table Implementation. Readings r Silbershatz et al:
CHAPTER 3-3: PAGE MAPPING MEMORY MANAGEMENT. VIRTUAL MEMORY Key Idea Disassociate addresses referenced in a running process from addresses available in.
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)
Solutions for the First Quiz COSC 6360 Fall 2014.
Chapter VIII Virtual Memory Jehan-François Pâris
Operating Systems, Winter Semester 2011 Practical Session 9, Memory 1.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Memory: Page Table Structure
Memory Management (2).
ECE232: Hardware Organization and Design
Memory COMPUTER ARCHITECTURE
CS161 – Design and Architecture of Computer
ITEC 202 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.
Demand Paging Reference Reference on UNIX memory management
Module 9: Virtual Memory
Chapter 9 Virtual Memory
Demand Paging Reference Reference on UNIX memory management
EECE.4810/EECE.5730 Operating Systems
5: Virtual Memory Background Demand Paging
Virtual Memory فصل هشتم.
Chapter VIII Virtual Memory
Computer Architecture
Lecture 9: Caching and Demand-Paged Virtual Memory
Module 9: Virtual Memory
4.3 Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Chapter VIII Virtual Memory Review Questions Jehan-François Pâris

Chapter overview Virtual Memory –Address translation –On-demand fetch Page table organization Page replacement policies –Performance issues

Problem A computer has 32 bit addresses and a virtual memory with a page size of 8 kilobytes. –How many bits are used by the byte offset ? – What is the maximum size of a page table ?

Solution A computer has 32 bit addresses and a virtual memory with a page size of 8 kilobytes. –How many bits are used by the byte offset ? 8 kilobytes = 2 13 bytes The byte offset uses 13 bits

Solution A computer has 32 bit addresses and a virtual memory with a page size of 8 kilobytes. – What is the maximum size of a page table ? Since the byte offset uses 13 bits, the page number will use 32 – 13 = 19 bits Page tables can therefore have 2 19 = 512K entries

Problem A computer system has 32-bit addresses and a page size of 4 kilobytes. –What is the maximum number of pages a process can have? –How many bits of the virtual address will remain unchanged during the address translation process?

Solution A computer system has 32-bit addresses and a page size of 4 kilobytes. –What is the maximum number of pages a program can have? We divide the size of the virtual address space by the page size: 2 32 B / 4 KB = 2 32 / 2 12 = 2 20 = 1 M

Second part A computer system has 32-bit addresses and a page size of 8 kilobytes. –How many bits of the virtual address will remain unchanged during the address translation process?

Solution A computer system has 32-bit addresses and a page size of 8 kilobytes. –How many bits of the virtual address will remain unchanged during the address translation process? Since the page size is 4 KB = 2 12 B, the 12 least significant bits of the virtual address will remain unchanged

Problem An old virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2KB. Each page table entry occupies 4 bytes. –How many bits of the virtual address will remain unchanged by the address translation process? – What is the size of a page table? –How many page frames are there in main memory?

First part An old virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2 KB. Each page table entry occupies 4 bytes. –How many bits of the virtual address will remain unchanged by the address translation process?

Solution An old virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2KB. Each page table entry occupies 4 bytes. –How many bits of the virtual address will remain unchanged by the address translation process? Since the page size is 2KB = 2 11 B, the 11 least significant bits of the virtual address will remain unchanged

Second part An old virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2KB. Each page table entry occupies 4 bytes. –What is the size of a page table?

Solution An old virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2KB. Each page table entry occupies 4 bytes. –What is the size of a page table? We divide the size of the virtual address space by the page size: 4GB/2KB= 2 32 /2 11 = 2 21 entries or 2 21 x4 B = 2 23 B = 8 MB

Third part A virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2KB. Each page table entry occupies 4 bytes. – How many page frames are there in main memory?

Solution An old virtual memory system has 512 MB of main memory, a virtual address space of 4 GB and a page size of 2KB. Each page table entry occupies 4 bytes. – How many page frames are there in main memory? We divide the size of the main memory by the page size: 512 MB/2 KB= 2 29 /2 11 = 2 18 = 256 K page frames.

True or false A computer will never have a page referenced bit and a missing bit The dirty bit indicates whether a page has been recently accessed A page fault rate of one page fault per one thousand references is a good page fault rate A TLB miss rate of one miss per one thousand references is a good miss rate

Solution (I) A computer will never have a page referenced bit and a missing bit FALSE The dirty bit indicates whether a page has been recently accessed A page fault rate of one page fault per one thousand references is a good page fault rate A TLB miss rate of one miss per one thousand references is a good miss rate

Solution (II) A computer will never have a page referenced bit and a missing bit FALSE The dirty bit indicates whether a page has been recently accessed FALSE A page fault rate of one page fault per one thousand references is a good page fault rate A TLB miss rate of one miss per one thousand references is a good miss rate

Solution (III) A computer will never have a page referenced bit and a missing bit FALSE The dirty bit indicates whether a page has been recently accessed FALSE A page fault rate of one page fault per one thousand references is a good page fault rate FALSE A TLB miss rate of one miss per one thousand references is a good miss rate

Solution (IV) A computer will never have a page referenced bit and a missing bit FALSE The dirty bit indicates whether a page has been recently accessed FALSE A page fault rate of one page fault per one thousand references is a good page fault rate FALSE A TLB miss rate of one miss per one thousand references is a good miss rate TRUE

Problem Which page table organization allows entire page tables to reside in main memory? How is it possible?

Solution Which page table organization allows entire page tables to reside in main memory? Inverted page tables How is it possible? Inverted page tables only keep track of the pages that are present in main memory

Page Replacement Policies Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) do support real-time processes ? –Which one(s) do simulate a page-referenced bit ? –Which one(s) are partially based on the FIFO

First part Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) do support real-time processes ?

Solution Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) do support real-time processes ? Windows NT because each process has a fixed-size resident set

Second part Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) do simulate a page-referenced bit ?

Solution Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) do simulate a page-referenced bit ? Berkeley UNIX is the only one

Third part Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) are partially based on the FIFO

Solution Among the five following page replacement policies : Local LRU, Global LRU, Berkeley Clock, Mach and Windows NT –Which one(s) are partially based on the FIFO policy? Mach and Windows/NT

Page Replacement Policies Give examples of –Very bad page replacement policies? –Policies that are too costly to implement? –Good policies that do not require any hardware support?

Solution (I) Give examples of –Very bad page replacement policies? Local FIFO, Global FIFO –Policies that are too costly to implement? –Good policies that do not require any hardware support?

Solution (II) Give examples of –Very bad page replacement policies? Local FIFO, Global FIFO –Policies that are too costly to implement? Local LRU, Global LRU, Working Set –Good policies that do not require any hardware support?

Solution (III) Give examples of –Very bad page replacement policies? Local FIFO, Global FIFO –Policies that are too costly to implement? Local LRU, Global LRU, Working Set –Good policies that do not require any hardware support? Mach, Berkeley Clock, Windows NT

Problem Given the following page reference string and a very small memory that can only accommodate two pages, how many page faults will occur if the memory is managed a)By a FIFO policy b)By an LRU policy

Answer (I) Given the following page reference string and a very small memory that can only accommodate two pages, the FIFO policy will cause four page faults  Fetch page 0  Fetch page 1  Fetch page 2 and expel page 0  Fetch again page 0 and expel page 1

Answer (II) Given the following page reference string and a very small memory that can only accommodate two pages, the LRU policy will cause three page faults  Fetch page 0  Fetch page 1  Fetch page 2 and expel page 1