Day 19 Memory Management.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

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.
Allocating Memory.
Day 20 Memory Management. Assumptions A process need not be stored as one contiguous block. The entire process must reside in main memory.
Memory Management Design & Implementation Segmentation Chapter 4.
Chapter 7 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.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
Main Memory. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only.
Chapter 7 Memory Management
1 Lecture 8: Memory Mangement Operating System I Spring 2008.
VIRTUAL MEMORY. Virtual memory technique is used to extents the size of physical memory When a program does not completely fit into the main memory, it.
1 Memory Management Chapter 7. 2 Roadmap n Memory management u Objectives u Requirements n Simple memory management u Memory partitioning F Fixed partitioning.
Memory Management ◦ Operating Systems ◦ CS550. Paging and Segmentation  Non-contiguous memory allocation  Fragmentation is a serious problem with contiguous.
Virtual Memory Chantha Thoeun. Overview  Purpose:  Use the hard disk as an extension of RAM.  Increase the available address space of a process. 
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 32 Paging Read Ch. 9.4.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally MEMORYMANAGEMNT.
Operating System 7 MEMORY MANAGEMENT. MEMORY MANAGEMENT REQUIREMENTS.
Memory Management Chapter 7.
Chapter 7 Memory Management
Memory Management. Roadmap Basic requirements of Memory Management Memory Partitioning Basic blocks of memory management –Paging –Segmentation.
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.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
1 Address Translation Memory Allocation –Linked lists –Bit maps Options for managing memory –Base and Bound –Segmentation –Paging Paged page tables Inverted.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
Memory Management Continued Questions answered in this lecture: What is paging? How can segmentation and paging be combined? How can one speed up address.
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.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
MEMORY MANAGEMENT. memory management  In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. 
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.
COMP 3500 Introduction to Operating Systems Memory Management: Part 2 Dr. Xiao Qin Auburn University Slides.
Introduction to Paging. Readings r 4.3 of the text book.
Chapter 7 Memory Management
Memory Management Chapter 7.
ITEC 202 Operating Systems
Chapter 2 Memory and process management
Requirements, Partitioning, paging, and segmentation
Day 20 Virtual Memory.
Paging and Segmentation
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy 11/12/2018.
Operating System Concepts
Memory Management 11/17/2018 A. Berrached:CS4315:UHD.
Segmentation Lecture November 2018.
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.
Computer Architecture
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
So far… Text RO …. printf() RW link printf Linking, loading
Main Memory Background Swapping Contiguous Allocation Paging
Lecture 32 Syed Mansoor Sarwar
Memory Management Chapter 7.
Lecture 3: Main Memory.
So far in memory management…
Operating System Chapter 7. Memory Management
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
Presentation transcript:

Day 19 Memory Management

Assumptions A process need not be stored as one contiguous block. The entire process must reside in main memory.

Paging Split the process into small fixed size pages. Split main memory into fixed size frames. Frame size = page size Now, if a process is 4 pages long, find 4 free frames to hold the 4 pages. If 4 contiguous blocks are not found, that’s okay. Simply find 4 available blocks. No external fragmentation. No internal fragmentation (only last block) Use a page table to keep track of the frames that are allocated to the process.

Page table Every process in memory has a page table. A page table has as many entries as the process has pages. Indexed by the page number. Page table entry at a minimum holds the frame number.

Page number Frame number

Address translation in paging Logical address Address specified in the program (starting at 0) Physical address Actual address in main memory

Example If an instruction has a logical address of 20 and if the program is placed in a page in memory which starts at address 1024, then the physical address of the instruction will be 1044. If page size = frame size = 256 bytes Instruction is in page 0 which is placed in frame 4 Physical address = 4 x 256 + 20 = 1044.

Address translation in paging To make it convenient, the size of a page is the power of 2. Given a (page #, offset), find (frame #, offset) 2k > number of frames => k bits to hold the frame number 2n > number of pages => n bits to hold the page number 2m = number of bytes in a page => m bits to determine the offset within a page A logical address is n||m A physical address is simply k||m where k is the frame corresponding to page “n” (obtained from the page table).

Address calculation using a page table

Main memory Process Page table Page # Logical Address Value A 1 B 2 C Frame # Physical address Value E 1 F 2 G 3 H 4 7 8 A 9 B 10 C 11 D 12 15 16 M 17 N 18 O 19 P 5 20 I 21 J 22 K 23 L Page # Logical Address Value A 1 B 2 C 3 D 4 E 5 F 6 G 7 H 8 I 9 J 10 K 11 L 12 M 13 N 14 O 15 P Page # Frame # 2 1 5 3 4 Page table Logical address 6 = 0110 Page size = 4 => 2 bits for offset (i.e. 4 addresses per page) Number of pages = 4 => 2 bits for page number Frame size = page size = 4 => 2 bits ofr offset # of frames = 6 => 3 bits for frame number 01 10 a. Replace 01 i.e. page number by frame number i.e. 000 b. 000 10 is the address => 2

Example Translate logical address 6 = 0110 Page size (i.e. # of addresses per page) = 4 => 2 bits for offset # of pages = 4 => 2 bits for page number Frame size = page size = 4 => 2 bits for offset # of frames = 6 => 3 bits for frame number Logical address = 01 10 a. Replace 01 i.e. page number by frame number i.e. 000 b. 000 10 is the physical address => 2 Page number Offset

Segmentation Divide a process into unequal blocks called segments. Reflects the logical organization of the program. Makes sharing simpler. A physical address consists of a segment address and an offset. Similar to dynamic partitioning, except the process need not be in a contiguous block. No internal fragmentation as the block can be just as large as needed. There can be external fragmentation. Use a segment table. An entry must hold the start address in main memory and a bounds address or an end address.

Address translation in segmentation Consider an n+m bit address. “n” is the segment number and the rightmost “m” bits are the offset. Given a logical address, Extract the “n” leftmost bits. You must know what “n” is or know how many segments there are. (x segments => log2x bits = n) Use the process segment table to determine what the starting address of the segment is. Use the remaining bits (offset) and compare with the length of the segment. If greater than the length of the segment, an interrupt has occurred. If not, base address + offset will give the physical address.

Address Translation using a segment table