Memory Management Design & Implementation Segmentation Chapter 4.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Memory Management.
Paging: Design Issues. Readings r Silbershatz et al: ,
Chapter 4 Memory Management Page Replacement 补充:什么叫页面抖动?
Part IV: Memory Management
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
1 Thursday, July 06, 2006 “Experience is something you don't get until just after you need it.” - Olivier.
Virtual Memory Background Demand Paging Performance of Demand Paging
Virtual Memory Introduction to Operating Systems: Module 9.
Segmentation and Paging Considerations
CS 311 – Lecture 21 Outline Memory management in UNIX
CS 153 Design of Operating Systems Spring 2015
Understanding Operating Systems1 Operating Systems Virtual Memory Thrashing Single-User Contiguous Scheme Fixed Partitions Dynamic Partitions.
1 Pertemuan 16 Isu-Isu pada Sistem Paging dan Segmentasi Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Memory Management 2010.
Memory Management (continued) CS-3013 C-term Memory Management CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
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.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Memory ManagementCS-502 Fall Memory Management CS-502 Operating Systems Fall 2006 (Slides include materials from Operating System Concepts, 7 th.
Memory Management Chapter 5.
1 Virtual Memory Management B.Ramamurthy Chapter 10.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Memory Management From Chapter 4, Modern Operating Systems, Andrew S. Tanenbaum.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally MEMORYMANAGEMNT.
Operating Systems Chapter 8
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
1 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.
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 1. Background Programs must be brought (from disk) into memory for them to be run Main memory and registers are only storage CPU can.
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
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
1 Memory Management. 2 Fixed Partitions Legend Free Space 0k 4k 16k 64k 128k Internal fragmentation (cannot be reallocated) Divide memory into n (possible.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Virtual Memory The memory space of a process is normally divided into blocks that are either pages or segments. Virtual memory management takes.
Memory Management OS Fazal Rehman Shamil. swapping Swapping concept comes in terms of process scheduling. Swapping is basically implemented by Medium.
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 Memory Management Adapted From Modern Operating Systems, Andrew S. Tanenbaum.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
SLC/VER1.0/OS CONCEPTS/OCT'99
Memory Management.
Main Memory Management
Module 9: Virtual Memory
Paging and Segmentation
Chapter 8: Main Memory.
Page Replacement.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
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.
Module IV Memory Organization.
5: Virtual Memory Background Demand Paging
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Memory Management-I 1.
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 9: Virtual Memory
Lecture 3: Main Memory.
Chapter 8: Memory Management strategies
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
Module 9: Virtual Memory
COMP755 Advanced Operating Systems
Page Main Memory.
Presentation transcript:

Memory Management Design & Implementation Segmentation Chapter 4

Design & implementation issues Thrashing –A process is thrashing if it spending more time paging than executing. Global vs. local page frame allocation Page size Separate instruction & data spaces Page sharing Paging daemon

Why thrashing occurs When CPU utilization is low, the OS increases the degree of multiprogramming. If some process enters a new phase and needs more frames, these frames may be taken away from other processes –These other processes then begin to create page faults As the processes wait for paging devices, CPU utilization decreases, so more processes are added…

How to stop thrashing Decrease the degree of multiprogramming by suspending some processes and writing their pages out to storage, thus freeing up some frames. Use a local page-replacement algorithm. –Then, if one process starts thrashing, it cannot take away pages from another process and cause that process to thrash also. Use a working set algorithm

Global vs Local Allocation Global replacement schemes allow a process to select a replacement frame from the set of all frames, even if that frame has been allocated to another process. –Thrashing is a common side effect Local replacement requires that each process select from its own set of allocated frames. –The number of frames allocated to a process is fixed.

Page Size Advantages of small page size –less internal fragmentation –better fit for various data structures, code sections –less unused program in memory Disadvantages –programs need many pages, larger page tables

Separate Instruction and Data Spaces One address space Separate I and D spaces Separate page tables

Sharing Pages Two processes can share code –Best to have only one copy of the code in main memory If instructions and data have separate page tables, it is easy to share only those pages with instructions

Sharing Pages Two processes share a program bysharing its instruction page table P1 P2

Paging daemon Periodically inspects the state of memory –If too few frames are free, it uses the page replacement algorithm to select pages to evict It may also maintain a list of modified pages. –Whenever the paging device is idle, the paging daemon may select a modified page and writes it out to the disk. It then sets the modified bit back to 0. –This increases the probability that a page will be clean when it is selected for replacement

Segmentation When we write a structured program, we create a main function and other functions. –Each of these functions is a code segment of variable length Locations within a segment are offset from the beginning of the segment Segmentation is a memory-management scheme that supports this user’s view of memory

Segments The logical & physical address spaces store each segment as a unit. –Each segment has a name and a length –Addresses specify the segment and the offset The user specifies addresses in terms of segment name and offset –Compare this with paging, where and the hardware divides the process into pages

Hardware requirements for segmentation To map the logical to the physical address we need a segment table Each entry in the segment table has a segment base and a segment limit –The segment base contains the starting physical address of the segment –The segment limit specifies the length of the segment

Advantages of segmentation Protection can be assigned per segment Code segments can be defined as read- only or execute only Arrays can be placed in their own segment. This means that the hardware will check for attempts to stray outside array boundaries (by using illegal indexes)

Paging, segmentation & fragmentation Paging –eliminates external fragmentation pages & frames are fixed sizes / a page is 2 k bytes –a small amount of internal fragmentation is introduced Segmentation –segments are of variable length, so external fragmentation is still a problem –swapping is more difficult

Comparing paging and segmentation