EECS 678: Intro to Operating Systems Programming Assignment 3: Virtual Memory in Nachos

Size: px
Start display at page:

Download "EECS 678: Intro to Operating Systems Programming Assignment 3: Virtual Memory in Nachos"

Transcription

1 EECS 678: Intro to Operating Systems Programming Assignment 3: Virtual Memory in Nachos 1. Introduction 2. Background 3. Assignment 4. Implementation Details 5. Implementation Overview 6. Testing and Validation 7. Sample Performance Data Table 8. A Few Quick Notes 9. Questions 10. Grading and Submission 1. Introduction In this project you are required to implement the "Working Set" scheme and three pagereplacement policies in the Nachos operating system as discussed in class (and in your book). You will then use your implementation to collect data describing the performance of these algorithms and answer a number of questions. As in PA2, you may do this assignment in groups of two. To be sure you start with the same Nachos archive as this project description assumes, please grab this assignment's starter code from the website. If you do not start with this TAR file to implement this project, I will not grade your project. You may want to refer back to the Nachos documentation on the website for some details on the memory system in Nachos. The lab on Tuesday, November 14 will also cover the memory system in Nachos. 2. Background: The Working Set The working set is the set of all virtual pages a process is actively using. To prevent a process from thrashing pages in and out, a record is kept of which pages are accessed during a fixed accounting interval. This access record is then used to calculate page membership in the working set and to determine how many physical pages should be granted to the process. Most systems for implementing a working set involve using a record of N intervals. Page accesses are "remembered" over time by setting bits in a bit field of a given length. As time proceeds, new data is shifted into the most significant bit (MSB) of the field and old data is shifted out periodically. In this way, the length of the bit field in the page table entry directly determines the amount of history it can keep about access to each page. The number of history bits (the number of accounting intervals) is referred to as the "Delta". The history field for a page table entry with a Delta of 8 is shown below. Note that during time periods t1, t3, and t7, the page is accessed. This information is shifted once to the right at the end of each time interval and, by period t9, the first access is "forgotten".

2 3. The Assignment and Implementation Details In this project you will be required to implement simple working set management policies in Nachos as described above. The size (Delta) of the page access history bit field will be varied, and you will perform tests to see how different sizes affect performance. Values will be 1, 2, 4, and 8 bits (and thus time periods). You will also be required to implement 3 page replacement (victim selection) algorithms to be used in conjunction with your working set implementation. For this project you will be required to implement FIFO (section in the text), LRU Approximation (this is the Record Reference Bit algorithm in the slides also known as the Additional-Reference-Bits Algorithm from section in the text), and Enhanced Second Chance (this is similar to the Second Chance algorithm discussed in class see section in the text for details). Implementation Details To differentiate between the two meanings of "working set" in the rest of this document, we will use the term "actual working set size" for the number of virtual pages a process has used in recent history and the term "prescribed working set size" for the number of physical pages the kernel has determined a process can be using. As will become evident below, both values will change throughout the execution of a process. One way to implement the working set schema is to introduce a bit-field into the page table entry (class TranslationEntry) for each page of a processes' virtual memory. For this project, you will need to keep a history of 8 intervals. Therefore, you can use an unsigned char to store your history. We have prepared some simple example code using C/C++ bit operations to help with the details. When a page is accessed by a program, the virtual address of the page is translated to a physical address by address translation logic (in Machine::Translate). This logic should be modified to record the page access in that page's history field. Since the data is moved from left to right, you should set the

3 most significant bit of the history field to indicate an access occurred during the current accounting interval. When a page is written to, TranslationEntry::dirty is set to true. This will indicate when a page is dirty and therefore needs to be written out to disk when it is paged out. This information is required by the Enhanced Second Chance algorithm. We will compare the size of the actual working set to the number of physical pages the process owns. When the process owns more physical pages (a.k.a. "frames") than it is actually using, we will take away some of its unused physical pages so that they can be better utilized by other processes in the system. We can achieve this repossession of unused pages by periodically inquiring how many pages the process is actively using and, with that number, constraining the process's address space size by setting the prescribed working set size for the near future of the process's execution. In this way, a process's actual working set size can grow at any rate (based on which virtual pages it accesses), but it will never own more physical frames than its prescribed working set size at a given time. A related implementation is specified in the next paragraph. Each time the scheduling interrupt expires (i.e. each quantum), we increment and test a counter associated with the current thread. When this counter expires, it is reset and the Thread::refreshWss() member function is invoked for the current thread. You need to fill in this stub in order to calculate the actual working set size for the process. This is done by counting the number of pages the process has accessed in the last Delta measurement intervals using the access bit fields in the page table entry for each page. The prescribed working set size will be set to this actual working set size and will remain at that number until the next call to Thread::refreshWss(). Until that point, it will be used to determine when a process is using too many physical pages (as discussed above). Since the history is shifted from left to right, information on the most recent interval is contained in the most significant bit. You can use an AND operation to look at only the top Delta bits as follows: Delta Mask Example 1 0x80 history & 0x80 2 0xC0 history & 0xC0 4 0xF0 history & 0xF0 8 0xFF history & 0xFF You should make the minimum prescribed working set size of a process 4 pages and the maximum prescribed working set size 32 pages. This will ensure that no process is forced to use fewer than a minimally feasible number of frames or is allowed to use too many frames at once. The lower limit of 4 is fairly easy to see. The upper limit of 32 is quite arbitrary, and would normally depend on the nature of the application programs. If the process is using too many frames, the extra pages should be paged out immediately. Selecting which pages to page out relies on the page replacement policy, as explained below. When selecting a page to page out, information contained in the access history bit fields of all the virtual pages currently mapped to physical pages can be used to implement several replacement algorithms (i.e. LRU Approximation, FIFO, etc). The function MemoryManager::Choose_Victim is

4 called whenever a page needs to be paged out. This function determines which page-replacement policy is being used and calls the appropriate function in the AddrSpace object (AddrSpace::FIFO_Choose_Victim, AddrSpace::LRU_Choose_Victim, or AddrSpace::SC_Choose_Victim). You need to implement these policies by filling in the functions for which we have provided stubs in userprog/addrspace.cc. Every time a process' working set size is refreshed, the history bits for that process's address space should also be aged by shifting them to the right one position. In C, you can use the >> operator to shift an integer to the right (e.g. 0x8 >> 1 == 0x4). This allows the process to slowly "forget" old accesses. Each time a thread runs for 10 quanta, the handout code will cause Nachos to invoke Thread::refreshWss() for the current thread. Just to be absolutely clear, that function should: 1. Calculate the new prescribed working set size (which is just the actual working set size at the moment). 2. Make certain that the thread does not own more frames than its new prescribed working set size allows (e.g. consider the scenario where step 1 actually calculates a smaller number than the prescribed working set size was before); we call this the contract step. 3. Shift the reference history associated with each virtual page in the thread's address space. The selection of 10 quanta as the period was rather arbitrary. In our testing, we have found that it tends to reveal the type of trends we want you to discover, but there is nothing more complex than that behind the choice. Other values might work better. This project used to refresh the prescribed working set size on every quantum, but that frequency seemed to be too restrictive because it was rather difficult for a program to reference very many pages in a period only 8 quanta long (which is the most history a thread could have: delta = 8). Now delta = 8 corresponds to a history window of 80 quanta, in which a thread can reference many more pages, providing a far richer view of what pages are being used. Realize that the sampling period can also be too long, so any period's effectiveness can be evaluated only with respect to program behavior being measured. NOTE: By default the contract step is disabled. You still need to implement this step, but the trends we wish you to recognize are less obvious when contraction is enabled. Therefore, when you answer the questions, you will disable contraction. Implementation Overview Think of this section as a quick overview of everything you will need to implement as described in the above section. You will need to keep track of information on a per-virtual page basis. In Nachos, this will mean making modifications to the TranslationEntry class to keep track of your new data. You will need new fields for the following: Reference History - Set the MS bit during a reference and shift to the right after each access accounting quantum as discussed above. Load Time - Update with the current clock cycle (this is the time stamp counter on a Pentiumclass CPU) when the page is loaded into memory. NOTE: The calls are already in place to set this value when appropriate. You only need to fill in the stub functions listed below. NOTE: The fields you need for the enhanced second chance algorithm (i.e. when a page is referenced, and whether or not it has been written to) have already been initialized and are already being updated

5 properly. Also, if you implement the Reference History field correctly, you do not need to introduce any other fields to implement the LRU policy correctly. Once you have added new fields to the TranslationEntry, you need to properly update these values. First, you will need to implement the body of the clearrefhistory, settime, and gettime functions, which should properly initialize your page statistics. Second, you will need to implement updates to your access fields in the function Machine::Translate. Every time a thread refreshes its prescribed working set size (in Thread::refreshWss), you need to calculate the new prescribed working set size, trim down the process's owned frames to match the newly calculated prescribed working set size by paging out some pages if necessary, and then shift the history information. Finally, you need to implement the body of the stub functions (in userprog/addrspace.cc) which will actually choose a victim page to be swapped out based on your new data fields. The stub routines are listed in the next section. Stub Routines We have provided a set of empty functions which are called at appropriate places in the code for proper operation. These are listed below. You will need to modify them to work with your code. userprog/addrspace.cc These stub routines should select a physical page based on the named algorithm. See the comments in the code for more detail. SC_Choose_Victim LRU_Choose_Victim FIFO_Choose_Victim The other stub routine you must fill in is AddrSpace::TooManyFrames. This routine must decide if the process owns more frames than its prescribed working set allows. TranslationEntry::clearRefHistory This should reset your reference history information to values appropriate when the page is first loaded into memory. TranslationEntry::setTime This should set the time information to the value specified. TranslationEntry::getTime This should return the time information for the page. Important Files Files that you will need to reference or modify include: userprog/addrspace.h - Contains the definition of Address Spaces userprog/addrspace.cc - Contains the implementation of Address Spaces machine/translate.h - Contains the definition of the virtual to physical address translation routines machine/translate.cc - Contains the implementation of the virtual to physical address translation routines threads/thread.h - Contains the definition of the Thread Class threads/thread.cc - Contains the implementation of the Thread Class, including the Thread::refreshWss routine. threads/system.h - Contains the definitions of the variables wsdeltasize and pagereplpolicy which you must use in your algorithms. threads/system.cc - Sets the variables wsdeltasize and pagereplpolicy which you must use in your algorithms.

6 userprog/memmgr.h - Contains the definition of the Memory Manager userprog/memmgr.cc - Contains the implementation of the Memory Manager, including ChooseVictim - the main page replacement dispatch algorithm. userprog/swapmgr.h - Contains the definition of the Swap Manager userprog/swapmgr.cc - Contains the implementation of the Swap Manager userprog/bitmap.h - Contains the definition of a bit map userprog/bitmap.cc - Contains the implementation of a bit map Disclaimer As with the previous Nachos projects, the amount of code to be written is not very large but it requires a significant amount of thought. If you find yourself writing much more than 200 lines of new code, you probably need to rethink what you're doing and how you're doing it. This means you need to start thinking about this project early (i.e. NOW). 6. Testing and Validation The most obvious performance metric for page replacement and working set management algorithms is the page fault frequency, which we gather using histograms. We will also use the total number of page faults experienced by a program during its execution and also gather the number of page-outs. Recall that a given approach will work better for some access patterns than others. We provide four user programs for this assignment which exhibit different memory access patterns and which thus exercise the page replacement and working set management algorithms in different ways. For each page replacement algorithm, you should gather data for each of the 4 Delta values on the 4 user programs we have provided (access1 through access4) and gather the number of page faults and page outs that occur. This data gathering step has been automated for you by the make regress make target in the nachos/dsui-vm/page_replacement_policy directory. It is invoked like this: "make regress". It must be ran from within the nachos/dsui-vm/page_replacement_policy directory. When it completes running its tests (which takes a few minutes) the data collected may be analyzed for statistics and used to generate histograms showing the number of machine ticks between page faults. Example run of "make regress" (actual parameters have been shortened here): > cd nachos/dsui-vm/page_replacement_policy > make regress Starting subprocess:../userprog/nachos -S swapfile_fifo_1_access1 -prp fifo -delta 1 -x access1 Starting subprocess:../userprog/nachos -S swapfile_fifo_2_access1 -prp fifo -delta 2 -x access1 Starting subprocess:../userprog/nachos -S swapfile_fifo_4_access1 -prp fifo -delta 4 -x access1 Starting subprocess:../userprog/nachos -S swapfile_fifo_8_access1 -prp fifo -delta 8 -x access1... others for lru, secondchance, access1-4, etc....

7 After the tests have ran there are two types of post-processing that can be done. The first is to generate a table, listing for each combination of program, page replacement policy, and delta, the number of page faults versus page outs. The second is to generate histograms showing the number of ticks between page faults. But before either the table or histograms can be generated we must post-process the data collected. Post-Process Testing Data > cd nachos/dsui-vm/page_replacement_policy > make postprocess This step will analyze the data collected from running make regress and prepare data for display and conversion into histograms. This step must be preformed before generating the table or histograms, and it takes several minutes (I recommend using cycle4 if you're using the cycle servers). Generate Page Fault Stats Table (form: Page Faults / Page Outs) > cd nachos/dsui-vm/page_replacement_policy > make table The performance data table will be sent to standard out and must be included in your report. If this fails, it is probably because instances of post-processing are still finishing. Just wait a few seconds (or check what is running with `ps aux`). Generate Histograms > cd nachos/dsui-vm/page_replacement_policy > make histos The generated histograms will be found in the dsui-vm/page_replacement_policy/pdfs directory New Command Line Options for Nachos The commands above will test each user program for each possible page replacement policy and delta value, but in order to facilitate testing of your individual page replacement algorithms with different delta values, we have added a few new command line options to Nachos. -prp <page-replacement policy> = allows you to select the page-replacement policy to be used by the system. There are four policies available: 1. dumb - Dummy algorithm 2. fifo - First-In First-Out 3. lru - LRU approximation 4. secondchance - Enhanced Second Chance At this point, only the dumb algorithm works. You must implement the code for the other algorithms. This value is stored in the variable pagereplpolicy. Its value is tested in MemoryManager::ChooseVictim to select the right algorithm. -delta <delta size> = allows you to set the Delta size for the actual working set calculations. This should be either 1, 2, 4, or 8. The default value is 1. This value is stored in the global variable wsdeltasize. You must use this value in your algorithms to maintain the working sets.

8 7. Sample Table A correct implementation will yield the following performance data table. See the explanation on the next page for how to interpret this. Program = access1: delta=1 delta=2 delta=4 delta=8 dumb 1640/ / / /1079 fifo 1641/ / / /1079 lru 1027/ / / /1011 secondchance 1027/ / / /1011 Program = access2: delta=1 delta=2 delta=4 delta=8 dumb 35977/ / / /33808 fifo 35978/ / / /33808 lru 32813/ / / /32753 secondchance 32771/ / / /32739 Program = access3: delta=1 delta=2 delta=4 delta=8 dumb 17/8 16/7 14/4 14/1 fifo 19/9 16/7 16/4 13/0 lru 13/7 13/6 13/3 13/0 secondchance 13/7 13/6 13/3 13/0 Program = access4: delta=1 delta=2 delta=4 delta=8 dumb 161/ /112 53/36 14/1 fifo 163/ / /104 13/0 lru 103/97 103/96 103/93 13/0 secondchance 103/97 103/96 103/93 13/0 Performance Table Interpretation The number on the left is the number of page faults for each run and the number on the right is the number of page outs. A perfect implementation will match exactly, but minor discrepancies are likely small errors and will not lose many points. The important thing is that the data in your table show similar trends. If the table produced by your implementation never matches these numbers, feel free to use this table to answer the questions below as opposed to the table produced by your implementation.

9 8. A Few Quick Notes Before proceeding, I have a few notes on the tests you have run or will run and the terminology used in the Nachos output and the questions below. Page Fault vs. Page In vs. Page Out A page fault occurs when a process has to access memory that is not already in its working set. A page in is essentially the same thing, but Nachos does not count the initial page in of the process' first page of program text and its last page of address space (i.e. its stack) as page faults. Thus, there will always be two more page ins than page faults. When answering the questions below, you may ignore these initial page ins (i.e. do not count them as page faults as Nachos does). A page out occurs when a process attempts to page in a page when its working set is full, and thus, must choose a victim to page out of its own working set. Startup and Exit Page Faults When Nachos starts a process, there are always two page faults as it works itself through the library code to the main program function. Similarly, there are always two page faults when a process navigates the code to exit a process. These are reported by Nachos as page faults, but you may ignore these four page faults when answering the following questions. The Contraction Step The code, as handed out, does not actually do the contraction step: it won't ever take frames away from a thread. This is contrary to the background information regarding the Working Set Scheme. When contraction is enabled, the trends we wish you to find are less obvious; thus, we've disabled contraction by default. This is what the wsscontractionenabled variable is for. That variable is sensitive to a command line switch to Nachos: "cwss". If the switch is present on the command line, then contraction ought to take place. For answering these questions, do not enable contraction. Please do try running tests with contraction enabled to see the difference; to do so, open dsui-vm/page_replacement_policy/prp_tests.py and add the "-cwss" option to the arg_list variable on line 66. The Big Picture As mentioned before, the code refreshes the working set size after every 10 quanta. Growth in the working set size is a consequence of the history of page reference: more referenced pages means a bigger working set size. Note that as delta increases, the amount of available history also increases. Because the history is used to determine the working set size, greater delta sizes yield greater working set sizes. Our Test Programs access1,2,3 and 4 are simple memory loads designed to stress the PRP algorithms in predictable ways. access1 and access2 are the Row-major and Col-major access orders on the 1024 page array. access3 is Row-major on a 10 page array and access4 is 10 iterations of access3.

10 9. Questions For your final report, you must answer the following questions: 1. What is the absolute fewest possible number of page faults for access1 in Nachos? Note that the compiler stores its arrays in row-major order (see the note in access1.c) and that Nachos employs demand paging. What about for access3? 2. What is the absolute fewest possible number of page faults for access2 in Nachos? Note that the difference between access1 and access2 is the pattern in which they traverse the array. 3. Why does delta affect access1 page fault count for FIFO and DUMB but not for LRU and Enhanced Second Chance? 4. Look at the inter-page fault histogram for access1 with a delta of 8 for all the PRPs. All of the generated histograms are located in dsui-vm/page_replacement_policy/pdfs directory (the.histo files are located in dsui-vm/page_replacement_policy/histos). See the Testing and Validation section for how to create the histograms. There ought to be a main spike which all PRPs share. Explain the existence of that spike: to what does it correspond? This is a similar question to guide what we are looking for on question 4: SampleQ: Look at the histogram for access2 with a delta of 8 with Enhanced Second Chance. There ought to be one significant spike and another much smaller spike located at a larger tick count which all PRPs share (open the.histo file with a text editor; note that the minimum and maximum values for empty buckets ought to be ignored). Explain the existence of those two spikes: to what do they correspond? SampleA: For access2, there is a page fault for each iteration of the inner loop. The spike at the lesser tick count corresponds to the number of instructions between memory writes in the inner loop: it takes about 24 ticks for the inner loop body to write a value, increment the loop counter, check the loop condition, compute the next element's address, and then write to it. The other spike corresponds to when the outer loop is also incremented/tested between writes. Together they add up to = 32768, the number of data page faults. The big spike is 1024 times bigger than the small spike, because the inner loop happens that many more times than does the outer. 5. Now consider page-outs and three major influences: 1) PRP, 2) delta size => working set size, and 3) the program's memory access pattern. Consider 3) as you answer these two questions: For 1), in which programs did the PRP not really affect the page-outs, and give a reasonable reason for that. For 2), in which programs did the delta size have an effect? Where did it not? Why?

11 10.Grading and Submission For this project, you should turn in the following items: 1. The source tree you modified with a root directory named using your KUIDs bundeled into a TAR file and ed to me (mikejant@ku.edu). 2. A project report. This report should contain: 1. Discussion of design. Explain the reasoning behind the implementation you have coded. 2. Brief discussion of how you tested and debugged your implementation. 3. Brief explanation of the table of results from make table. Mention the different kind of memory access patterns exemplified by each program, why the page replacement algorithms handle each pattern as they do, and how (and why) the delta values affect the results. 4. Answers to the questions in section 9. Grading will be divided as follows: Approach Works Correctly 70% Design and Results Doc 10% Questions 20% Good luck. And please start early. This project is significantly more difficult than the previous assignments.

Virtual Memory In Nachos

Virtual Memory In Nachos Virtual Memory In Nachos Michael Jantz Prasad Kulkarni EECS 678 Nachos Virtual Memory 1 Introduction This lab is intended to introduce the final Nachos assignment. Please grab the starter code for this

More information

MODERN OPERATING SYSTEMS. Chapter 3 Memory Management

MODERN OPERATING SYSTEMS. Chapter 3 Memory Management MODERN OPERATING SYSTEMS Chapter 3 Memory Management No Memory Abstraction Figure 3-1. Three simple ways of organizing memory with an operating system and one user process. Base and Limit Registers Figure

More information

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory

Virtual Memory. Virtual Memory. Demand Paging. valid-invalid bit. Virtual Memory Larger than Physical Memory Virtual Memory Virtual Memory CSCI Operating Systems Design Department of Computer Science Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture were based on those Operating Systems Concepts, 9th ed., by Silberschatz, Galvin, and

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Chapter 9: Virtual Memory 9.1 Background 9.2 Demand Paging 9.3 Copy-on-Write 9.4 Page Replacement 9.5 Allocation of Frames 9.6 Thrashing 9.7 Memory-Mapped Files 9.8 Allocating

More information

Module 9: Virtual Memory

Module 9: Virtual Memory Module 9: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmenation 9.1 Background

More information

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

More information

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 14 Page Replacement Jonathan Walpole Computer Science Portland State University Page replacement Assume a normal page table (e.g., BLITZ) User-program is

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating

More information

Chapter 9: Virtual-Memory

Chapter 9: Virtual-Memory Chapter 9: Virtual-Memory Management Chapter 9: Virtual-Memory Management Background Demand Paging Page Replacement Allocation of Frames Thrashing Other Considerations Silberschatz, Galvin and Gagne 2013

More information

Module 9: Virtual Memory

Module 9: Virtual Memory Module 9: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmentation Operating

More information

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced? Chapter 10: Virtual Memory Questions? CSCI [4 6] 730 Operating Systems Virtual Memory!! What is virtual memory and when is it useful?!! What is demand paging?!! When should pages in memory be replaced?!!

More information

Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSC Operating Systems Spring 2007

Background. Demand Paging. valid-invalid bit. Tevfik Koşar. CSC Operating Systems Spring 2007 CSC 0 - Operating Systems Spring 007 Lecture - XIII Virtual Memory Tevfik Koşar Background Virtual memory separation of user logical memory from physical memory. Only part of the program needs to be in

More information

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 14 Page Replacement. Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 14 Page Replacement Jonathan Walpole Computer Science Portland State University Page replacement Assume a normal page table (e.g., BLITZ) User-program is

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 23 Virtual memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Is a page replaces when

More information

Virtual Memory. ICS332 Operating Systems

Virtual Memory. ICS332 Operating Systems Virtual Memory ICS332 Operating Systems Virtual Memory Allow a process to execute while not completely in memory Part of the address space is kept on disk So far, we have assumed that the full address

More information

Operating Systems Lecture 6: Memory Management II

Operating Systems Lecture 6: Memory Management II CSCI-GA.2250-001 Operating Systems Lecture 6: Memory Management II Hubertus Franke frankeh@cims.nyu.edu What is the problem? Not enough memory Have enough memory is not possible with current technology

More information

Virtual Memory: Page Replacement. CSSE 332 Operating Systems Rose-Hulman Institute of Technology

Virtual Memory: Page Replacement. CSSE 332 Operating Systems Rose-Hulman Institute of Technology Virtual Memory: Page Replacement CSSE 332 Operating Systems Rose-Hulman Institute of Technology Announcements Project E & presentation are due Wednesday Team reflections due Monday, May 19 The need for

More information

CS510 Operating System Foundations. Jonathan Walpole

CS510 Operating System Foundations. Jonathan Walpole CS510 Operating System Foundations Jonathan Walpole Page Replacement Page Replacement Assume a normal page table (e.g., BLITZ) User-program is executing A PageInvalidFault occurs! - The page needed is

More information

Page Replacement. 3/9/07 CSE 30341: Operating Systems Principles

Page Replacement. 3/9/07 CSE 30341: Operating Systems Principles Page Replacement page 1 Page Replacement Algorithms Want lowest page-fault rate Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number

More information

Memory Management. Virtual Memory. By : Kaushik Vaghani. Prepared By : Kaushik Vaghani

Memory Management. Virtual Memory. By : Kaushik Vaghani. Prepared By : Kaushik Vaghani Memory Management Virtual Memory By : Kaushik Vaghani Virtual Memory Background Page Fault Dirty Page / Dirty Bit Demand Paging Copy-on-Write Page Replacement Objectives To describe the benefits of a virtual

More information

Page 1. Goals for Today" TLB organization" CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement"

Page 1. Goals for Today TLB organization CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement Goals for Today" CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" Finish discussion on TLBs! Page Replacement Policies! FIFO, LRU! Clock Algorithm!! Working Set/Thrashing!

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 15: Caching: Demand Paged Virtual Memory

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 15: Caching: Demand Paged Virtual Memory CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2003 Lecture 15: Caching: Demand Paged Virtual Memory 15.0 Main Points: Concept of paging to disk Replacement policies

More information

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD OPERATING SYSTEMS #8 After A.S.Tanenbaum, Modern Operating Systems 3rd edition Uses content with permission from Assoc. Prof. Florin Fortis, PhD MEMORY MANAGEMENT MEMORY MANAGEMENT The memory is one of

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Chapter 9: Virtual Memory Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations

More information

Operating System Concepts

Operating System Concepts Chapter 9: Virtual-Memory Management 9.1 Silberschatz, Galvin and Gagne 2005 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped

More information

Virtual Memory - II. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XVI. University at Buffalo.

Virtual Memory - II. Roadmap. Tevfik Koşar. CSE 421/521 - Operating Systems Fall Lecture - XVI. University at Buffalo. CSE 421/521 - Operating Systems Fall 2012 Lecture - XVI Virtual Memory - II Tevfik Koşar University at Buffalo October 25 th, 2012 1 Roadmap Virtual Memory Page Replacement Algorithms Optimal Algorithm

More information

a process may be swapped in and out of main memory such that it occupies different regions

a process may be swapped in and out of main memory such that it occupies different regions Virtual Memory Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be located contiguously in main memory Memory references are dynamically

More information

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018 CS 31: Intro to Systems Virtual Memory Kevin Webb Swarthmore College November 15, 2018 Reading Quiz Memory Abstraction goal: make every process think it has the same memory layout. MUCH simpler for compiler

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Silberschatz, Galvin and Gagne 2013 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

MEMORY: SWAPPING. Shivaram Venkataraman CS 537, Spring 2019

MEMORY: SWAPPING. Shivaram Venkataraman CS 537, Spring 2019 MEMORY: SWAPPING Shivaram Venkataraman CS 537, Spring 2019 ADMINISTRIVIA - Project 2b is out. Due Feb 27 th, 11:59 - Project 1b grades are out Lessons from p2a? 1. Start early! 2. Sketch out a design?

More information

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001. Readings and References Virtual Memory Reading Chapter through.., Operating System Concepts, Silberschatz, Galvin, and Gagne CSE - Computer Systems December, Other References Chapter, Inside Microsoft

More information

Optimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs

Optimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs Optimal Algorithm Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs page 1 Least Recently Used (LRU) Algorithm Reference string: 1, 2, 3,

More information

Chapter 9: Virtual Memory. Chapter 9: Virtual Memory. Objectives. Background. Virtual-address address Space

Chapter 9: Virtual Memory. Chapter 9: Virtual Memory. Objectives. Background. Virtual-address address Space Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations

More information

Chapter 8: Virtual Memory. Operating System Concepts

Chapter 8: Virtual Memory. Operating System Concepts Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2009 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

Chapter 10: Virtual Memory. Background

Chapter 10: Virtual Memory. Background Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples 10.1 Background Virtual memory separation of user logical

More information

Where are we in the course?

Where are we in the course? Previous Lectures Memory Management Approaches Allocate contiguous memory for the whole process Use paging (map fixed size logical pages to physical frames) Use segmentation (user s view of address space

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations

More information

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Memory Management ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective Part I: Operating system overview: Memory Management 1 Hardware background The role of primary memory Program

More information

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it to be run Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester Mono-programming

More information

Chapter 10: Virtual Memory. Background. Demand Paging. Valid-Invalid Bit. Virtual Memory That is Larger Than Physical Memory

Chapter 10: Virtual Memory. Background. Demand Paging. Valid-Invalid Bit. Virtual Memory That is Larger Than Physical Memory Chapter 0: Virtual Memory Background Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples Virtual memory separation of user logical memory

More information

COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager

COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager Points Possible: 100 Submission via Canvas No collaboration among groups. Students in one group should NOT share any project

More information

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time.

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time. Memory Management To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time. Basic CPUs and Physical Memory CPU cache Physical memory

More information

1. Overview This project will help you understand address spaces and virtual memory management.

1. Overview This project will help you understand address spaces and virtual memory management. Project 2--Memory Worth: 12 points Assigned: Due: 1. Overview This project will help you understand address spaces and virtual memory management. In this project, you will implement an external pager,

More information

CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement"

CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" October 3, 2012 Ion Stoica http://inst.eecs.berkeley.edu/~cs162 Lecture 9 Followup: Inverted Page Table" With

More information

Basic Page Replacement

Basic Page Replacement Basic Page Replacement 1. Find the location of the desired page on disk 2. Find a free frame: - If there is a free frame, use it - If there is no free frame, use a page replacement algorithm to select

More information

10: Virtual Memory Management

10: Virtual Memory Management CSC400 - Operating Systems 10: Virtual Memory Management J. Sumey Introduction virtual memory management: concerned with the actual management operations of a virtual memory system fetch strategies: when

More information

Paging algorithms. CS 241 February 10, Copyright : University of Illinois CS 241 Staff 1

Paging algorithms. CS 241 February 10, Copyright : University of Illinois CS 241 Staff 1 Paging algorithms CS 241 February 10, 2012 Copyright : University of Illinois CS 241 Staff 1 Announcements MP2 due Tuesday Fabulous Prizes Wednesday! 2 Paging On heavily-loaded systems, memory can fill

More information

Virtual Memory Outline

Virtual Memory Outline Virtual Memory Outline Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations Operating-System Examples

More information

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

CS6401- Operating System UNIT-III STORAGE MANAGEMENT UNIT-III STORAGE MANAGEMENT Memory Management: Background In general, to rum a program, it must be brought into memory. Input queue collection of processes on the disk that are waiting to be brought into

More information

Swapping. Operating Systems I. Swapping. Motivation. Paging Implementation. Demand Paging. Active processes use more physical memory than system has

Swapping. Operating Systems I. Swapping. Motivation. Paging Implementation. Demand Paging. Active processes use more physical memory than system has Swapping Active processes use more physical memory than system has Operating Systems I Address Binding can be fixed or relocatable at runtime Swap out P P Virtual Memory OS Backing Store (Swap Space) Main

More information

Memory Management Outline. Operating Systems. Motivation. Paging Implementation. Accessing Invalid Pages. Performance of Demand Paging

Memory Management Outline. Operating Systems. Motivation. Paging Implementation. Accessing Invalid Pages. Performance of Demand Paging Memory Management Outline Operating Systems Processes (done) Memory Management Basic (done) Paging (done) Virtual memory Virtual Memory (Chapter.) Motivation Logical address space larger than physical

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L20 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Questions from last time Page

More information

Virtual Memory. Chapter 8

Virtual Memory. Chapter 8 Virtual Memory 1 Chapter 8 Characteristics of Paging and Segmentation Memory references are dynamically translated into physical addresses at run time E.g., process may be swapped in and out of main memory

More information

Chapter 8 Virtual Memory

Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Chapter 8 Virtual Memory Seventh Edition William Stallings Operating Systems: Internals and Design Principles You re gonna need a bigger boat. Steven

More information

CS 385 Operating Systems Fall 2011 Homework Assignment 4 Simulation of a Memory Paging System

CS 385 Operating Systems Fall 2011 Homework Assignment 4 Simulation of a Memory Paging System CS 385 Operating Systems Fall 2011 Homework Assignment 4 Simulation of a Memory Paging System Due: Tuesday November 15th. Electronic copy due at 2:30, optional paper copy at the beginning of class. Overall

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 18: Page Replacement Terminology in Paging A virtual page corresponds to physical page/frame Segment should not be used anywhere Page out = Page eviction

More information

Basic Memory Management

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it

More information

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition Chapter 9: Virtual Memory Silberschatz, Galvin and Gagne 2013 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

Operating Systems. Overview Virtual memory part 2. Page replacement algorithms. Lecture 7 Memory management 3: Virtual memory

Operating Systems. Overview Virtual memory part 2. Page replacement algorithms. Lecture 7 Memory management 3: Virtual memory Operating Systems Lecture 7 Memory management : Virtual memory Overview Virtual memory part Page replacement algorithms Frame allocation Thrashing Other considerations Memory over-allocation Efficient

More information

Chapter 9: Virtual Memory

Chapter 9: Virtual Memory Chapter 9: Virtual Memory Chapter 9: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Demand Segmentation Operating System Examples 9.2 Background

More information

Virtual Memory COMPSCI 386

Virtual Memory COMPSCI 386 Virtual Memory COMPSCI 386 Motivation An instruction to be executed must be in physical memory, but there may not be enough space for all ready processes. Typically the entire program is not needed. Exception

More information

Introduction to Nachos Scheduling

Introduction to Nachos Scheduling Introduction to Nachos Scheduling Michael Jantz Dr. Prasad Kulkarni 1 Introduction In this lab, we will become acquainted with the Nachos simulator, and make a slight change to its scheduling semantics.

More information

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory. Demand Paging

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory. Demand Paging TDDB68 Concurrent programming and operating systems Overview: Virtual Memory Virtual Memory [SGG7/8] Chapter 9 Background Demand Paging Page Replacement Allocation of Frames Thrashing and Data Access Locality

More information

Principles of Operating Systems

Principles of Operating Systems Principles of Operating Systems Lecture 21-23 - Virtual Memory Ardalan Amiri Sani (ardalan@uci.edu) [lecture slides contains some content adapted from previous slides by Prof. Nalini Venkatasubramanian,

More information

Chapter 8 Virtual Memory

Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles Chapter 8 Virtual Memory Seventh Edition William Stallings Modified by Rana Forsati for CSE 410 Outline Principle of locality Paging - Effect of page

More information

Virtual Memory - Overview. Programmers View. Virtual Physical. Virtual Physical. Program has its own virtual memory space.

Virtual Memory - Overview. Programmers View. Virtual Physical. Virtual Physical. Program has its own virtual memory space. Virtual Memory - Overview Programmers View Process runs in virtual (logical) space may be larger than physical. Paging can implement virtual. Which pages to have in? How much to allow each process? Program

More information

Chapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition

Chapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

Chapter 9. Software Testing

Chapter 9. Software Testing Chapter 9. Software Testing Table of Contents Objectives... 1 Introduction to software testing... 1 The testers... 2 The developers... 2 An independent testing team... 2 The customer... 2 Principles of

More information

Lecture 17. Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne

Lecture 17. Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne Lecture 17 Edited from slides for Operating System Concepts by Silberschatz, Galvin, Gagne Page Replacement Algorithms Last Lecture: FIFO Optimal Page Replacement LRU LRU Approximation Additional-Reference-Bits

More information

Page Replacement Algorithms

Page Replacement Algorithms Page Replacement Algorithms MIN, OPT (optimal) RANDOM evict random page FIFO (first-in, first-out) give every page equal residency LRU (least-recently used) MRU (most-recently used) 1 9.1 Silberschatz,

More information

Memory management, part 2: outline

Memory management, part 2: outline Memory management, part 2: outline Page replacement algorithms Modeling PR algorithms o Working-set model and algorithms Virtual memory implementation issues 1 Page Replacement Algorithms Page fault forces

More information

CSE 120 Principles of Operating Systems

CSE 120 Principles of Operating Systems CSE 120 Principles of Operating Systems Fall 2016 Lecture 11: Page Replacement Geoffrey M. Voelker Administrivia Lab time This week: Thu 4pm, Sat 2pm Next week: Tue, Wed At Washington University in St.

More information

Past: Making physical memory pretty

Past: Making physical memory pretty Past: Making physical memory pretty Physical memory: no protection limited size almost forces contiguous allocation sharing visible to program easy to share data gcc gcc emacs Virtual memory each program

More information

Memory: Paging System

Memory: Paging System Memory: Paging System Instructor: Hengming Zou, Ph.D. In Pursuit of Absolute Simplicity 求于至简, 归于永恒 Content Paging Page table Multi-level translation Page replacement 2 Paging Allocate physical memory in

More information

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory

Virtual Memory. Overview: Virtual Memory. Virtual address space of a process. Virtual Memory TDIU Operating systems Overview: Virtual Memory Virtual Memory Background Demand Paging Page Replacement Allocation of Frames Thrashing and Data Access Locality [SGG7/8/9] Chapter 9 Copyright Notice: The

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 18 Lecture 18/19: Page Replacement Memory Management Memory management systems Physical and virtual addressing; address translation Techniques: Partitioning,

More information

UNIT - IV. What is virtual memory?

UNIT - IV. What is virtual memory? UNIT - IV Virtual Memory Demand Paging Process creation Page Replacement Allocation of frames Thrashing- File Concept - Access Methods Directory Structure File System Mounting File Sharing Protection.

More information

Week 2: Tiina Niklander

Week 2: Tiina Niklander Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Policies and methods Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka

More information

Practice Exercises 449

Practice Exercises 449 Practice Exercises 449 Kernel processes typically require memory to be allocated using pages that are physically contiguous. The buddy system allocates memory to kernel processes in units sized according

More information

Page replacement algorithms OS

Page replacement algorithms OS Page replacement algorithms OS 2007-08 1 When a page fault occurs OS has to choose a page to evict from memory If the page has been modified, the OS has to schedule a disk write of the page The page just

More information

Chapter 3: Virtual Memory ว ตถ ประสงค. Background สามารถอธ บายข อด ในการท ระบบใช ว ธ การจ ดการหน วยความจ าแบบเสม อนได

Chapter 3: Virtual Memory ว ตถ ประสงค. Background สามารถอธ บายข อด ในการท ระบบใช ว ธ การจ ดการหน วยความจ าแบบเสม อนได Chapter 9: Virtual Memory Chapter 3: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations

More information

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels Memory management, part 2: outline 1 Page Replacement Algorithms Page fault forces choice o which page must be removed to make room for incoming page? Modified page must first be saved o unmodified just

More information

All Paging Schemes Depend on Locality. VM Page Replacement. Paging. Demand Paging

All Paging Schemes Depend on Locality. VM Page Replacement. Paging. Demand Paging 3/14/2001 1 All Paging Schemes Depend on Locality VM Page Replacement Emin Gun Sirer Processes tend to reference pages in localized patterns Temporal locality» locations referenced recently likely to be

More information

Today. Adding Memory Does adding memory always reduce the number of page faults? FIFO: Adding Memory with LRU. Last Class: Demand Paged Virtual Memory

Today. Adding Memory Does adding memory always reduce the number of page faults? FIFO: Adding Memory with LRU. Last Class: Demand Paged Virtual Memory Last Class: Demand Paged Virtual Memory Benefits of demand paging: Virtual address space can be larger than physical address space. Processes can run without being fully loaded into memory. Processes start

More information

Operating Systems, Fall

Operating Systems, Fall Policies and methods Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka

More information

Chapter 4 Memory Management

Chapter 4 Memory Management Chapter 4 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 33 Virtual Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ How does the virtual

More information

3/3/2014! Anthony D. Joseph!!CS162! UCB Spring 2014!

3/3/2014! Anthony D. Joseph!!CS162! UCB Spring 2014! Post Project 1 Class Format" CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" Mini quizzes after each topic Not graded Simple True/False Immediate feedback for

More information

Demand Paging. Valid-Invalid Bit. Steps in Handling a Page Fault. Page Fault. Transfer of a Paged Memory to Contiguous Disk Space

Demand Paging. Valid-Invalid Bit. Steps in Handling a Page Fault. Page Fault. Transfer of a Paged Memory to Contiguous Disk Space Demand Paging Transfer of a Paged Memory to Contiguous Disk Space Bring a page into memory only when it is needed. Less I/O needed Less memory needed Faster response More users Page is needed reference

More information

PAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo

PAGE REPLACEMENT. Operating Systems 2015 Spring by Euiseong Seo PAGE REPLACEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics What if the physical memory becomes full? Page replacement algorithms How to manage memory among competing processes? Advanced

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle

Operating Systems Virtual Memory. Lecture 11 Michael O Boyle Operating Systems Virtual Memory Lecture 11 Michael O Boyle 1 Paged virtual memory Allows a larger logical address space than physical memory All pages of address space do not need to be in memory the

More information

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College CISC 7310X C08: Virtual Memory Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/22/2018 CUNY Brooklyn College 1 Outline Concepts of virtual address space, paging, virtual page,

More information

Chapters 9 & 10: Memory Management and Virtual Memory

Chapters 9 & 10: Memory Management and Virtual Memory Chapters 9 & 10: Memory Management and Virtual Memory Important concepts (for final, projects, papers) addressing: physical/absolute, logical/relative/virtual overlays swapping and paging memory protection

More information

Address spaces and memory management

Address spaces and memory management Address spaces and memory management Review of processes Process = one or more threads in an address space Thread = stream of executing instructions Address space = memory space used by threads Address

More information

Reminder: Mechanics of address translation. Paged virtual memory. Reminder: Page Table Entries (PTEs) Demand paging. Page faults

Reminder: Mechanics of address translation. Paged virtual memory. Reminder: Page Table Entries (PTEs) Demand paging. Page faults CSE 451: Operating Systems Autumn 2012 Module 12 Virtual Memory, Page Faults, Demand Paging, and Page Replacement Reminder: Mechanics of address translation virtual address virtual # offset table frame

More information

Clock page algorithm. Least recently used (LRU) NFU algorithm. Aging (NFU + forgetting) Working set. Process behavior

Clock page algorithm. Least recently used (LRU) NFU algorithm. Aging (NFU + forgetting) Working set. Process behavior When a page fault occurs Page replacement algorithms OS 23 32 OS has to choose a page to evict from memory If the page has been modified, the OS has to schedule a disk write of the page The page just read

More information

Examining Load Average

Examining Load Average Examining Load Average Source : http://www.linuxjournal.com/article/9001 Understanding work-load averages as opposed to CPU usage Many Linux administrators and support technicians regularly use the top

More information

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time Memory Management To provide a detailed description of various ways of organizing memory hardware To discuss various memory-management techniques, including paging and segmentation To provide a detailed

More information