Class Note for CMPSCI 377 at UMass(20)
Class Note for CMPSCI 377 at UMass(20)
Popular in Course
Popular in Department
This 3 page Class Notes was uploaded by an elite notetaker on Friday February 6, 2015. The Class Notes belongs to a course at University of Massachusetts taught by a professor in Fall. Since its upload, it has received 14 views.
Reviews for Class Note for CMPSCI 377 at UMass(20)
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 02/06/15
CMPSCI 377 Operating Systems Fall 2007 Lecture 8 October 4 Lecturer Emery Berger Scribes 81 Lecture Summary Virtual Memory vs Physical Memory mmapped lO o TLB Thrashing Paging Thrashing Shared Memory 82 Virtual Memory Memory are divided into page in which the physical address is mapped to a Virtual address Processes use virtual addresses which start at 07 and are allocated lazily onto pages 821 Memory Management Unit MMU The MMU is in charge of tranlating virtual addresses to their physical address It maintains a page table big hash table to map the translations This is unfortunately too slow when it comes to looking up the addresses7 so we want the table to also be in the cache The cache is about 100 times faster than RAM 822 Translation Lookaside Buffer TLB The alternative is a TLB which is a fully associative cache expensive where the size is limited It caches the records used for page translations7 the page number and the frame The powers of 2 is used to simplify virtual to physical address translations The virtual space size is 2m7 and page size 2 The high order min of the address is used to select a page7 and the low order selects the offset Chances of a miss in the TLB is high due to its small size 8 to 2048 entries The assumption made is once a page is touched7 it will be in use for awhile If the TLB was larger7 it would improve the hit ratio and decrease average memory cost Every process has its own set of mapping page hash table7 meaning each process has its own associated table or TLB When changing processes7 the TLB of the old process is to be deleted7 and a new TLB is created for the new process in a new table This process is known as TLB shootdown Note that the the old TLB are not stored in cache TLB thrashing occurs when it visits pages all over the place in and out between the cache and disk memory that it slows down the entire process The working set exceeds the size of TLB 8 1 82 Lecture 8 October 4 823 Bene ts of Virtual Memory 0 Simpler Everyone gets the illusion of that it is the whole address space There7s no need to worry about who else may be accessing that same memory it can be treated as if its all yours 0 Segments One person only manages one small chunk If a bigger chunk is needed must fetch it manually 0 Isolation Every process is protected from every other No read or write is allowed to or from other processes There is Stability if it tries to do this a segmentation violation is given so that it doesn7t overwrite something else There are 2 bits stored in the TLB that distinguishes whether the memory is read and writable 1 bit each and sometimes an extra bit for exe 0 Optimization It reduces space requirements 83 Sharing Memory Paging allows the sharing of memory across processes signi cantly reducing memory requirements As long as all processes accessing the same single page in memory is not altering or writing into the memory then it can be viewed readonly by all processes Hence code is always readonly while data is copyon write However sharing requires the hardware to be fast Static libraries in C are not shared everyone has their own copy if more than one process uses it 84 Life of A Page Allocate memory use it evict it some memory written to disk due to lack of memory and then reuse it 841 Allocate Memory Allocate memory by using mmap to obtain memory directly from the OS mmapped IO has no physical frame allocated at all until it starts to touch the pages The address space is reserved since memory is not committed to physical memory yet meaning it is still free Once the page is touched it beccomes committed address space now that the physical memory is in use and is not free Commmitting space is done lazily 842 Using Memory When memory is used the page tables are updates and when contents are written it is a dirty page 0 Linux LRU page evicted to disk 0 Windows LRU by program evicted to a pool lf touching a page may not use extra memory readshared writingused Lecture 8 October 4 83 843 Evicting Memory Paged out is forcing our page to be evicted It saves whatever is in the swap space disk and then gives up the physical memory ReadWrite from this virtual memory is no longer possible When another page is touchced7 it is swapped in If you not desire certain memory to be swapped7 you can pin the memory Pin memory locks the memory and becomes self manageable A random tangent I wrote down in this section inkernel web servers avoids context switch Otherwise7 it has replacement policies 85 Paging 851 Cost of Paging Worstcase analysis is useless Easy to construct an adversary where every page requested is a page fault such as having A7B7C7D7E7F7G7H7LJ7AH being read by 5 bits There are in nite faults and it doesn7t matter which is evicted 852 Competitive Analysis Compare to optimal replacement policy kratio where k is the size of queue LRU and FIFO Its no worse than 5 timesfuture of page faults Can incur k times more misses than OPT7 no more than than 20000 times worse than the OPT 853 MIN aka OPT Optimal Page Replacement Evict page accessed furthest in the future This is similar to the idea of oracles Trace and simulate imperative studies it runs through and simulates make predictions of the future from the known
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'