Memory Management 2010.

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

Chapter 8 Virtual Memory
Memory Management Chapter 7.
Segmentation and Paging Considerations
Memory Management Chapter 7. Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as.
Chapter 7 Memory Management
Chapter 8 Virtual Memory Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice.
Memory Management Design & Implementation Segmentation Chapter 4.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Virtual Memory Chapter 8.
Virtual Memory Chapter 8.
Operating System Support Focus on Architecture
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 Chapter 7 B.Ramamurthy. Memory Management Subdividing memory to accommodate multiple processes Memory needs to allocated efficiently.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
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 Lecture 9: Virtual Memory Operating System I Spring 2007.
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 (Chapter 8) Memory Management is an intimate and complex interrelationship between processor hardware and operating system software. Paging.
Memory Management Chapter 5.
Computer Organization and Architecture
Virtual Memory I Chapter 8.
Chapter 8 Virtual Memory
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Review of Memory Management, Virtual Memory CS448.
Memory Management Chapter 7.
Virtual Memory Chapter 8. Characteristics of Paging and Segmentation A process may be broken up into pieces (pages or segments) that do not need to be.
Chapter 7 Memory Management
Cosc 2150: Computer Organization Chapter 6, Part 2 Virtual Memory.
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
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.
1 Virtual Memory Chapter 8. 2 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Chapter 4 Memory Management Virtual Memory.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Virtual Memory Chapter 8. 2 Virtual memory concept Simple paging/ segmentation  pages or segments are loaded into frames that may not necessarily be.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Memory Management Operating Systems CS550. Memory Manager Memory manager - manages allocation and de-allocation of main memory Plays significant impact.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Memory Management. Why memory management? n Processes need to be loaded in memory to execute n Multiprogramming n The task of subdividing the user area.
Informationsteknologi Wednesday, October 3, 2007Computer Systems/Operating Systems - Class 121 Today’s class Memory management Virtual memory.
Lectures 8 & 9 Virtual Memory - Paging & Segmentation System Design.
1 Lecture 8: Virtual Memory Operating System Fall 2006.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Memory Management Chapter 5 Advanced Operating System.
Virtual Memory Chapter 8.
Chapter 2 Memory and process management
ITEC 202 Operating Systems
William Stallings Computer Organization and Architecture
Chapter 8 Virtual Memory
Virtual Memory Chapter 8.
Lecture 10: Virtual Memory
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Virtual Memory فصل هشتم.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
COMP755 Advanced Operating Systems
Operating Systems: Internals and Design Principles, 6/E
CSE 542: Operating Systems
Presentation transcript:

Memory Management 2010

three levels hardware caches to speed up concurrent access from treads, cores, multiple cpu’s programming (language dependent) malloc, free new…, garbage collection OS number of programs in memory swap to/from disk size of programs 2010

OS Memory Management reference to data, e.g. linked list many programs and the OS (partly) in memory, ready to run when needed or possible efficient use of the cpu and the available memory 2010

Requirements Relocation: adjustment of references to memory when program is (re)located in memory Protection: against reading or writing of memory locations by another processes, during execution Sharing: data and code (libraries), communication between processes Logical Organization: programs are written in modules, compiled independently; different degrees of protection Physical Organization: memory available for a program plus its data may be insufficient; movements to and from disks 2010

Loading of programs Relocatable loading: address relative to fixed point (begin of program) in load module list of these addresses (relocation dictionary) loader adds (load address – fixed point) to those addresses Swapping only possible if program returns to same position. 2010

Dynamic Run Time loading Done in the hardware Can also provide protection Relative address is an example of a “logical” address, which is independent on the place of the program in physical memory 2010

Fixed partitioning The part of the memory not used by the operating system is divided in parts of equal or different length. Disadvantage of partitions of equal size: if the program is too big for the chosen size, the programmer must work with “overlays”. small programs still use the full partition: “internal fragmentation” of memory Advantage: placing of a new program in memory is easy: take any free partition 2010

Variable sized partitions Number and sizes of partitions are fixed during system generation There may be day/night variation: more small partitions during the day for testing; more large partitions during night for production. two choices for loading new programs Maximizes number of loaded programs Minimizes internal fragmentation 2010

Dynamic partitioning Each process gets exactly (ceiled to 1, 2 or 4KB) the memory it needs. Number and size of the partitions are variable Gives “external fragmentation” If that gets too big: use “compaction”: stop all processes move them in memory, all free space at the end need algorithm for placement of processes 2010

Paging Partition memory into small equal-size chunks (frames) and divide each process into the same size chunks (pages) Operating system maintains a page table for each process: contains the frame location for each page in the process memory address consists of a page number and offset A special hardware register points during execution to the page table of the executing process. An extra read access to memory is thus needed, caching (in the CPU) can be used to speed it up. Contiguous frames in memory are not necessary; as long as there are more free frames than pages in a process, the process can be loaded and executed. No external fragmentation. Little internal fragmentation (only in the last page of a process) 2010

Process page table process maximal 64 pages of 1KB each physical memory maximal 64 frames of 1KB Add 2 bits to the physical address and to the page tables: there are now 256 pages of 1 KB a process can still have maximal 64 pages, be 64 KB long there can be more processes in memory 2010

Segmentation No internal fragmentation, only external Process is divided into a number of segments, which can be of different size; there is a maximal size. For each process there is a table with the starting address of each segment; segments can be non-contiguous in memory. Segmentation is often visible for the programmer which can place functions and data blocks into certain segments. No internal fragmentation, only external Placement algorithm is needed Base address can be longer, to use more physical memory Tables are larger than with paging; more hardware support needed. 2010

Virtual memory basis Two properties of simple paging and segmentation: all memory references in a process are logical addresses which during execution are dynamically converted by hardware to physical addresses a process can be divided in parts (pages or segments) which do not have to be in contiguous physical memory during execution are the basis for a fundamental breakthrough: not all the pages or segments of a process have to be in memory during execution as long as the next instruction and data items needed by it are in physical memory, the execution can proceed. if that is not the case (page or segment fault) those pages (or segments) must be loaded before execution can proceed not used pages or segments can be swapped to disk. 2010

VM Implications: more processes can be in memory: better usage of the CPU, better response times for interactive users a process can be larger than the available physical memory This gives the name “virtual memory”, available on the swap disk, not limited by the “real memory”. VM can be based on paging, segmentation, or both. Needed for virtual memory systems: hardware (address translation, usage bits, caches for speed) management software (tables, disk I/O, algorithms) VM now used on mainframes, workstations, PC’s, etc. Not for some “real time” systems as the execution time of processes is less predictable. 2010

Thrashing, locality principle Swapping out a piece of a process just before that piece is needed The processor spends most of its time swapping pieces rather than executing user instructions Principle of locality Program and data references within a process tend to cluster Only a few pieces of a process will be needed over a short period of time Possible to make intelligent guesses about which pieces will be needed in the future This suggests that virtual memory may work efficiently provided programmer and compiler care about locality 2010

Page tables in VM Control bits: P(resent): page in memory or on disk M(odified): page modified or not time indication of last use Two level, hierarchical page table Part of it can be on disk 2010

Translation Lookaside Buffer Contains page table entries that have been most recently used Functions same way as a memory cache 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 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 2010

Use of TLB 2010

Combined segmentation and paging Paging is transparent to the programmer Paging eliminates external fragmentation Segmentation is visible to the programmer (and compiler) allows for growing data structures, modularity, and support for sharing and protection embedded systems: program in ROM, data in RAM 2010

OS policies Fetch: when a page should be brought into memory? on-demand paging, only when needed pre-paging, bring in more, try to reduce page faults Replacement: which page is replaced? Frame Locking, to increase efficiency Kernel of the operating system, Control structures, I/O buffers Resident Set Size: how many pages per process fixed allocation variable allocation, global or local scope Cleaning: when to re-use a frame for another page on demand or pre-cleaning Load control: number of processes resident in main memory Process suspension: scheduling policy 2010