Virtual Memory:Part 2 Kashyap Sheth Kishore Putta Bijal Shah Kshama Desai.

Slides:



Advertisements
Similar presentations
Chapters 7 & 8 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Advertisements

Memory.
Chapter 8 Virtual Memory
Principles of Virtual Memory
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CS623: Lecture 3 February 10, 2004 © Joel Wein 2003, modified by T. Suel.
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice.
CSC 322 Operating Systems Concepts Lecture - 18: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Virtual Memory Chapter 8.
Memory Management (II)
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture 11: Memory Management
Memory Management 2010.
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.
Chapter 3.2 : Virtual Memory
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.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
Chapter 3 Memory Management: Virtual Memory
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Operating Systems Chapter 8
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Fall 2000M.B. Ibáñez Lecture 17 Paging Hardware Support.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
CE Operating Systems Lecture 14 Memory management.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Memory Management Fundamentals Virtual Memory. Outline Introduction Motivation for virtual memory Paging – general concepts –Principle of locality, demand.
Fundamentals of Programming Languages-II Subject Code: Teaching SchemeExamination Scheme Theory: 1 Hr./WeekOnline Examination: 50 Marks Practical:
CS399 New Beginnings Jonathan Walpole. Virtual Memory (1)
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
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.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
CSC 360, Instructor Kui Wu Memory Management I: Main Memory.
Memory Management Continued Questions answered in this lecture: What is paging? How can segmentation and paging be combined? How can one speed up address.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
Virtual Memory Pranav Shah CS147 - Sin Min Lee. Concept of Virtual Memory Purpose of Virtual Memory - to use hard disk as an extension of RAM. Personal.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
CS203 – Advanced Computer Architecture Virtual Memory.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Virtual Memory Chapter 8.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Outline Paging Swapping and demand paging Virtual memory.
COMBINED PAGING AND SEGMENTATION
Chapter 8 Virtual Memory
CS510 Operating System Foundations
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
Chapter 8: Main Memory.
Operating System Concepts
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Chapter 9: Virtual-Memory Management
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Memory Management-I 1.
Lecture 3: Main Memory.
CSE 451: Operating Systems Autumn 2005 Memory Management
Contents Memory types & memory hierarchy Virtual memory (VM)
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
Page Main Memory.
Presentation transcript:

Virtual Memory:Part 2 Kashyap Sheth Kishore Putta Bijal Shah Kshama Desai

Index Recap Translation lookaside buffer Segmentation Segmentation with paging Working set model References

Terms & Notions Virtual memory (VM) is Not a physical device but an abstract concept Comprised of the virtual address spaces (of all processes) Virtual address space (VAS) (of one process) Set of visible virtual addresses (Some systems may use a single VAS for all processes)

Paging Page: The Virtual Address Space is divided into equal number of units called a Page. Each page is of the same size. Page frame: The Physical Address Space is divided into equal number of units called Page Frames. Each page frame is of the same size. Memory Management Unit (MMU): it is used to map the virtual address onto the physical address.

Translation Lookaside Buffer Each virtual memory reference can cause two physical memory accesses one to fetch the page table one to fetch the data To overcome this problem a high-speed cache is set up for page table entries called the TLB - Translation Lookaside Buffer

Translation Lookaside Buffer Contains page table entries that have been most recently used Functions same way as a memory cache

Translation Lookaside Buffer Given a virtual address, processor examines the TLB If page table entry is present (a hit), the frame number is retrieved and the real address is formed If page table entry is not found in the TLB (a miss), the page number is used to index the process page table

Translation Lookaside Buffer First checks if page is already in main memory if not in main memory a page fault is issued The TLB is updated to include the new page entry

Operation of Paging and Translation Lookaside Buffer (Stallings Fig 8.8)

Use of a Translation Lookaside Buffer (Stallings Fig 8.7)

Segmentation What is Segmentation? Segmentation: Advantages Segmentation: Disadvantages

Virtual address space Call stack Parse tree Constant table Source text Symbol table Address space allocated to the parse tree free Space currently being used by the parse tree Symbol table has bumped into the source text table

MMU STBR STLR BaseLimitOther Segment table What is Segmentation? Seg 1 (code) Seg 2 (data) Seg 3 (stack) Virtual memory Segment #Offset virtual address memory access fault no Physical memory Seg 2 (data) Seg 1 (code) Seg 3 (stack) 0x00 as in paging: valid, modified, protection, etc. offset < limit ? External fragmentation Segment Base + Offset physical address yes

Segmentation: Advantages As opposed to paging: No internal fragmentation (but: external fragmentation) May save memory if segments are very small and should not be combined into one page (e.g. for reasons of protection) Segment tables: only one entry per actual segment as opposed to one per page in VM Average segment size >> average page size  less overhead (smaller tables)

Segmentation: Disadvantages External fragmentation Costly memory management algorithms Segmentation: find free memory area big enough (search!) Paging: keep list of free pages, any page is ok (take first!) Segments of unequal size not suited as well for swapping

Combined Segmentation and Paging (CoSP) What is CoSP? CoSP: Advantages CoSP: Disadvantages

CPU sso Seg ment limit Page table base Segment table( for process) < yes no + Logical address Memory trap so ppo Physical memory Page table (for segment) f f po Architecture For Segmentation With Paging

CoSP: Advantages Reduces memory usage as opposed to pure paging Page table size limited by segment size Segment table has only one entry per actual segment Simplifies handling protection and sharing of larger modules (define them as segments) Most advantages of paging still hold Simplifies memory allocation Eliminates external fragmentation Supports swapping, demand paging, prepaging etc.

CoSP: Disadvantages Internal fragmentation Yet only an average of about ½ page per contiguous address range Page 1 Page 2 Process requests a 6KB address range (4KB pages) internal fragmentation

Working Sets Working set of pages: minimum collection of pages that must be loaded in main memory for a process to operate efficiently without unnecessary page faults. “Smallest collection of information that must be present in main memory to assure efficient execution of the program. Process/Working Set: two manifestations of same ongoing computational activity.

Working Set Strategy W(t,D) = set of pages in memory at time t of that process that have been referenced in the last D virtual time units. Virtual time = time that elapses while process in execution measured in instruction steps. Working set size: number of pages in W(t,D).

Characteristics of Working Sets Size: Working set is non decreasing function of window (D) size. Specifically, W(t, D+1) contains W(t,D). Prediction: Expect intuitively that immediate past page reference behavior constitutes good prediction of immediate future behavior.

Detecting/Measuring W(t,D) Hardware mechanism to record if page referenced in last D seconds. Software: Sample page table entries at intervals of D/K. Any page that was referenced in these intervals is in working set.

Memory Allocation A program will not be run unless there is space in memory for its working set.

Using the Working Set Concept A strategy for resident set size: Monitor the working set of each process Periodically remove from the resident set of a process those pages that are not in its working set. A process may execute only if its working set is in main memory (if resident set includes its working set).

Issues With this Strategy Past does not necessarily predict future. Size and membership of working set change over time. A true measurement of WS for each process is impractical. Need to time stamp every page reference and keep a time-ordered queue. Optimal value of D is unknown and would vary.

Alternatively Look at page fault rate, not exact page references. Page fault rate falls as resident set size increases. If page fault rate is below some threshold, give a smaller resident set size If above some threshold, increase resident set size.

References Operating Systems,3 rd edition-Gary Nutt. Modern Operating systems,2 nd edition- Tanenbaum. World Wide Web. Operating Systems, William Stallings.

The End