Page 110/20/2015 CSE 30341: Operating Systems Principles So far…  Page  Fixed size pages solve page allocation problem (and external fragmentation) 

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Prof. Hsien-Hsin Sean Lee
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 36 Virtual Memory Read.
Paging Hardware With TLB
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Module 9: Memory Management
Chapter 8.3: Memory Management
Background A program must be brought into memory and placed within a process for it to be executed. Input queue – collection of processes on the disk that.
03/10/2004CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
A. Frank - P. Weisberg Operating Systems Simple/Basic Segmentation.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
03/17/2008CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
 Background  Swapping  Contiguous Allocation  Paging  Segmentation  Segmentation with Paging.
ECE668.1 Csaba Andras Moritz UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Computer Architecture ECE 668 Review of MMU and Virtual.
XE33OSA Chapter 8: Memory Management. 8.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 8: Memory Management Background Swapping Contiguous Allocation.
Shan Gao Fall 2007 Department of Computer Science Georgia State University.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Memory Management -1 Background Swapping Memory Management Schemes
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Silberschatz and Galvin  Operating System Concepts Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Operating Systems Chapter 8
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
1 CMSC421: Principles of Operating Systems Nilanjan Banerjee Principles of Operating Systems Acknowledgments: Some of the slides are adapted from Prof.
CS212: OPERATING SYSTEM Lecture 6: Virtual-Memory Management 1 Computer Science Department.
Lecture 8: Memory Management. Lecture 8 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents Problems of memory management Dynamic allocation.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Implementation of Page Table Page table is kept in main memory Page-table base.
CE Operating Systems Lecture 14 Memory management.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Silberschatz, Galvin and Gagne  Operating System Concepts Virtual Memory Virtual memory – separation of user logical memory from physical memory.
Lecture 19 Virtual Memory Demand Paging. Background Virtual memory – separation of user logical memory from physical memory. –Only part of the program.
9.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging.
Memory Management. Background Memory consists of a large array of words or bytes, each with its own address. The CPU fetches instructions from memory.
 The MULTICS system solved problems of external fragmentation and lengthy search times by paging the segments  Solution differs from pure segmentation.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples (not covered.
10.1 Chapter 10: Virtual Memory Background Demand Paging Process Creation Page Replacement Allocation of Frames Thrashing Operating System Examples.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 9: Virtual-Memory Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Chapter 8: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Chapter 2: Memory Management Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging Operating System Concepts.
W4118 Operating Systems Instructor: Junfeng Yang.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Chapter 8: Memory Management
Simple/Basic Segmentation
Paging and Segmentation
Storage Management Chapter 9: Memory Management
Segmentation Lecture November 2018.
Main Memory Background Swapping Contiguous Allocation Paging
Main Memory Session - 16.
Chapter 9: Virtual Memory
Lecture 3: Main Memory.
Chapter 8: Memory Management strategies
Lecture 37 Syed Mansoor Sarwar
Lecture 35 Syed Mansoor Sarwar
CSE 542: Operating Systems
Presentation transcript:

page 110/20/2015 CSE 30341: Operating Systems Principles So far…  Page  Fixed size pages solve page allocation problem (and external fragmentation)  paging hardware (hierarchical, hashed and inverted page table)

page 210/20/2015 CSE 30341: Operating Systems Principles 8.6: Segmentation  Memory-management scheme that supports user view of memory  A program is a collection of segments. A segment is a logical unit such as: main program, procedure, function, method, object, local variables, global variables, common block, stack, symbol table, arrays

page 310/20/2015 CSE 30341: Operating Systems Principles User’s View of a Program

page 410/20/2015 CSE 30341: Operating Systems Principles Logical View of Segmentation user spacephysical memory space

page 510/20/2015 CSE 30341: Operating Systems Principles Segmentation Architecture  Logical address consists of a two tuple:,  Segment table – maps two-dimensional physical addresses; each table entry has:  base – contains the starting physical address where the segments reside in memory  limit – specifies the length of the segment  Segment-table base register (STBR) points to the segment table’s location in memory  Segment-table length register (STLR) indicates number of segments used by a program; segment number s is legal if s < STLR

page 610/20/2015 CSE 30341: Operating Systems Principles Segmentation Architecture (Cont.)  Relocation.  dynamic  by segment table  Sharing.  shared segments  same segment number  Allocation.  first fit/best fit  external fragmentation

page 710/20/2015 CSE 30341: Operating Systems Principles Segmentation Architecture (Cont.)  Protection. With each entry in segment table associate:  validation bit = 0  illegal segment  read/write/execute privileges  Protection bits associated with segments; code sharing occurs at segment level  Since segments vary in length, memory allocation is a dynamic storage-allocation problem  A segmentation example is shown in the following diagram

page 810/20/2015 CSE 30341: Operating Systems Principles Address Translation Architecture

page 910/20/2015 CSE 30341: Operating Systems Principles Example of Segmentation

page 1010/20/2015 CSE 30341: Operating Systems Principles Sharing of Segments

page 1110/20/2015 CSE 30341: Operating Systems Principles Segmentation with Paging – MULTICS  The MULTICS system solved problems of external fragmentation and lengthy search times by paging the segments  Solution differs from pure segmentation in that the segment-table entry contains not the base address of the segment, but rather the base address of a page table for this segment

page 1210/20/2015 CSE 30341: Operating Systems Principles MULTICS Address Translation Scheme

page 1310/20/2015 CSE 30341: Operating Systems Principles 8.7: Intel Address Translation  segmentation with paging for memory management with a two-level paging scheme

page 1410/20/2015 CSE 30341: Operating Systems Principles Linux on Intel 80x86  Uses minimal segmentation to keep memory management implementation more portable  Uses 6 segments:  Kernel code  Kernel data  User code (shared by all user processes, using logical addresses)  User data (likewise shared)  Task-state (per-process hardware context)  LDT  Uses 2 protection levels:  Kernel mode  User mode

page 1510/20/2015 CSE 30341: Operating Systems Principles Chapter 9: Virtual memory  Virtual memory – separation of user logical memory from physical memory.  Only part of the program needs to be in memory for execution.  Logical address space can therefore be much larger than physical address space.  Allows address spaces to be shared by several processes.  Allows for more efficient process creation.  Virtual memory can be implemented via:  Demand paging  Demand segmentation

page 1610/20/2015 CSE 30341: Operating Systems Principles Demand Paging  Bring a page into memory only when it is needed  Less I/O needed if not all pages are needed  Less memory needed  Faster response  More users  Page is needed  reference to it  invalid reference  abort  not-in-memory  bring to memory

page 1710/20/2015 CSE 30341: Operating Systems Principles Valid-Invalid Bit  With each page table entry a valid–invalid bit is associated (1  in-memory, 0  not-in-memory)  Initially valid–invalid but is set to 0 on all entries  Example of a page table snapshot:  During address translation, if valid–invalid bit in page table entry is 0  page fault  Frame #valid-invalid bit page table

page 1810/20/2015 CSE 30341: Operating Systems Principles Page Table When Some Pages Are Not in Main Memory

page 1910/20/2015 CSE 30341: Operating Systems Principles Page Fault  If there is ever a reference to a page, first reference will trap to OS  page fault  OS looks at another table to decide:  Invalid reference  abort.  Just not in memory.  Get empty frame.  Swap page into frame.  Reset tables, validation bit = 1.  Restart instruction: Least Recently Used  block move  auto increment/decrement location

page 2010/20/2015 CSE 30341: Operating Systems Principles Steps in Handling a Page Fault