UMass Amherst ECE 397A - Homework 4- Virtual Memory

Unformatted text preview:

Operating SystemsHomework 4: Virtual Memory Q1. When do page faults occur? Describe the actions taken by the OS when a pagefault occurs. Q2. Suppose we have a system with 32 bit virtual addresses, in which the least-significant bits are used to indicate a 10-bit page offset. a) what is the page size in this system? b) how many pages would it take to cover the entire virtual address space? c) if you only bought 16MB of physical memory, how many page frames do you have? d) if page table entries are 64 bits long, how big of a single-level page table would yourequire to map all of virtual memory?Q3 Suppose we have a demand-paged memory. The page table is held in registers. Ittakes 8 milliseconds to service a page fault if an empty frame is available or the replacedpage is not modified, and 20 milliseconds if the replaced page is modified. Memoryaccess time is 100 nanoseconds.Assume that the page to replaced is modified 70 percent of the time. What is themaximum acceptable page-fault rate for an effective access time of no more than 200nanoseconds?Q4. Consider a program that generates a sequence of virtual address references thatcorrespond to the following sequence of page references: 1,2,3,4,1,2,5,6,1,3,1,2,7,6,3,2,1,2,3,6 (i.e., first it references an address in page #1, then an address in page #2, then an address in page #3, etc.) show how pages are populated in physical frames over time, and indicate where pagefaults occur, for each of the following cases: a) LRU page replacement, for each subcase of: i) 1 frame, ii) 3 frames, iii) 5 frames, iv) 7 frames b) FIFO page replacement, for each subcase of: i) 1 frame, ii) 3 frames, iii) 5 frames, iv) 7 framesc) Optimal page replacement, for each subcase of: i) 1 frame, ii) 3 frames, iii) 5 frames, iv) 7 frames Did you see an instance of Belady's anomaly? Q5. What is the cause of thrashing? How could a system detect thrashing? Once itdetects it, what can it do to eliminate the problem?Q6. Give reasons why the page size in a virtual memory system should be neither toolarge or too small.Q7. (20 points) Consider the two-dimensional array A:int A[100][100];where A[0][0] is at location 200, in a paged memory system with pages of size200 bytes. Each int type needs 4 bytes and A is stored in row-major order (as in C/C++).A small process is in page 0 (locations 0 to 199) for manipulating the array; thus, everyinstruction fetch will be from page 0. For three page frames, how many page faults aregenerated by the following array-initialization loops, using LRU replacement, andassuming frame 0 has the process in it and the other two frames are initially empty?(a) for (int I=0; I< 100; I++)for (int J=0; J < 100; J++) A[I][J]=0;(b) for (int I=0; I< 100; I++)for (int J=0; J < 100; J++) A[J][I]=0;Q8. A virtual memory system has a page size of 1024 words, eight virtual pages, and fourphysical page frames. The page table is as follows:Virtual page Number Page Frame Number 0 1 1 0 2 33 - 4 - 5 2 6 - 7 - a. What is the size of the virtual address space? (How many bits in a virtualaddress?) b. What is the size of the physical address space? (How many bits in a physicaladdress?) c. What are the physical addresses corresponding to the following decimal virtualaddresses (yes, you have to convert from decimal to binary): 0, 3728, 1023, 1024, 1025,7800,8500,


View Full Document

UMass Amherst ECE 397A - Homework 4- Virtual Memory

Download Homework 4- Virtual Memory
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework 4- Virtual Memory and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework 4- Virtual Memory 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?