Liu Meihua Chapter 3 Memory management Chapter 3 Memory management —— 3.5 Kernel Memory.

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Kernel memory allocation
Chapter 12. Kernel Memory Allocation
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
4/14/2017 Discussed Earlier segmentation - the process address space is divided into logical pieces called segments. The following are the example of types.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Memory Management. 2 How to create a process? On Unix systems, executable read by loader Compiler: generates one object file per source file Linker: combines.
Memory Management 2010.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Chapter 3 Memory Management
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.
Memory Management Chapter 5.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization Cs 147 Prof. Lee Azita Keshmiri.
Chapter 5: Memory Management Dhamdhere: Operating Systems— A Concept-Based Approach Slide No: 1 Copyright ©2005 Memory Management Chapter 5.
1 Memory Management in Representative Operating Systems.
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
Dynamic Partition Allocation Allocate memory depending on requirements Partitions adjust depending on memory size Requires relocatable code –Works best.
CSNB334 Advanced Operating Systems 5. Memory Management
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Operating Systems Memory management. Memory Management List of Topics 1. Memory Management 2. Memory In Systems Design 3. Binding Times 4. Introduction.
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.
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
Chapter 4 Memory Management Virtual Memory.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
CS 390 Unix Programming Environment
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Memory Management Chapter 5 Advanced Operating System.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
CS 140 Lecture Notes: Virtual Memory
OPERATING SYSTEM CONCEPTS AND PRACTISE
Virtual Memory CSSE 332 Operating Systems
Chapter 8: Main Memory.
Process Management Process Concept Why only the global variables?
CSE 120 Principles of Operating
Chapter 8: Memory Management
Outline Paging Swapping and demand paging Virtual memory.
Chapter 9: Virtual Memory
COMBINED PAGING AND SEGMENTATION
Modeling Page Replacement Algorithms
Chapter 8: Main Memory.
CS 140 Lecture Notes: Virtual Memory
Operating System Concepts
Chapter 9: Virtual-Memory Management
Segmentation Lecture November 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.
Main Memory Background Swapping Contiguous Allocation Paging
CS 140 Lecture Notes: Virtual Memory
Modeling Page Replacement Algorithms
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Lecture 3: Main Memory.
CSCE 313 – Introduction to UNIx process
Operating System Chapter 7. Memory Management
Contents Memory types & memory hierarchy Virtual memory (VM)
Chapter 8: Memory Management strategies
Computer System Structures
Lecture 35 Syed Mansoor Sarwar
CS703 - Advanced Operating Systems
CS 140 Lecture Notes: Virtual Memory
Chapter 8: Main Memory.
CSE 542: Operating Systems
Page Main Memory.
Presentation transcript:

Liu Meihua Chapter 3 Memory management Chapter 3 Memory management —— 3.5 Kernel Memory

2 Outline  Kernel virtual memory layout  Kernel memory slab allocator

Kernel virtual memory layout  The Kernel uses virtual memory.  The Kernel uses the memory management unit(MMU) to translate its virtual memory addresses into physical pages.  The Kernel has its own address space and corresponding virtual memory layout.  Most of the kernel ’ s memory is nonpageable.  Kernel memory consists of a variety of mappings.  Nonpageable kernel memory is mapped with the segkmem kernel segment driver. Pageable kernel memory is mapped with the segkp segment driver.

Kernel virtual memory layout  Kernel Address Space  The Kernel Text and Data Segments  Virtual Memory Data Structures  Loadable kernel Module Text and Data  The Kernel Address Space and Segments

5 Kernel Address Space  It contains the following major mappings:  The kernel text and data (mappings of the kernel binary)  The kernel map space (data structures, caches, etc.)  A 32-bit kernel map, for module text and data (64-bit kernels only)  The trap table  Critical virtual memory data structures (TSB, etc.)  A place for mapping the file system cache (segmap)

6  Solari s Bit Virtual Addres s Space

7  The text segments contain the instructions  The data segments contains the initialized variables from the kernel/unix image file.  They are mapped into the kernel address space by the Open Boot PROM The Kernel Text and Data Segments

8 Virtual Memory Data Structures

9 Loadable Kernel Module Text and Data

10 Loadable Kernel Module Text and Data  Looking at the module load address with the modinfo command

11  Solaris does allow some portions of the kernel to be allocated from pageable memory.  Pageable memory is restricted to those structures that are not required by the kernel when the process is swapped out:  Lightweight process stacks  The TNF Trace buffers  Special pages, such as the page of memory that is shared between user and kernel for scheduler preemption control  Pageable memory is allocated and swapped by the seg_kp segment. Loadable Kernel Module Text and Data

12 The Kernel Address Space and Segments

13 The Kernel Address Space and Segments  The full list of segment drivers the kernel uses to create and manage kernel mappings is shown in following table.

14 Outline  Kernel virtual memory layout  Kernel memory slab allocator

The Kernel Memory Slab Allocator  Slab Allocator Overview  Object Caching  Slab Allocator Implementation  The CPU Layer  The Depot Layer  The Global (Slab) Layer The slab allocator: the general-purpose memory allocator.

16 Slab Allocator Overview  The slab allocator consumes large slabs of memory and then allocates smaller requests with portions of each slab.  Use the slab allocator for memory requests that are:  Smaller than a page size  Not an even multiple of a page size  Frequently going to be allocated and freed, so would otherwise fragment the kernel map

17 Slab Allocator Overview  Performance comparison of the slab allocator.

18  The slab allocator uses the following terms:  object to describe a single memory allocation unit  cache to refer to a pool of like objects  slab to refer to a group of objects that reside within the cache  Each object type has one cache, which is constructed from one or more slabs. Slab Allocator Overview

19  Objects, Caches, Slabs, and Pages of Memory

20 Object Caching  The allocator tries to defer most of the real work associated with allocation and deallocation until it is really necessary, by keeping the objects alive until memory needs to be returned to the back end.

21 Slab Allocator Implementation

22 The CPU Layer  The CPU layer caches groups of objects to minimize the number of times that an allocation will need to go down to the lower layers.

23 The Depot Layer  The depot layer assembles groups of objects into magazines. Unlike a slab, a magazine ’ s objects are not necessarily allocated from contiguous memory; rather, a magazine contains a series of pointers to objects within slabs.

24 The Global (Slab) Layer  The global slab layer allocates slabs of objects from contiguous pages of physical memory and hands them up to the magazine layer for allocation. The global slab layer is used only when the upper layers need to allocate or deallocate entire slabs of objects to refill their magazines.

25 End