Operating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1

Similar documents
The Memory Management Unit. Operating Systems. Autumn CS4023

Background. Contiguous Memory Allocation

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Performance of Various Levels of Storage. Movement between levels of storage hierarchy can be explicit or implicit

Main Memory (Part I)

CS420: Operating Systems

CS370 Operating Systems

Chapter 8: Main Memory

Chapter 8: Main Memory

CS307 Operating Systems Main Memory

Chapter 8: Memory Management Strategies

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation

8.1 Background. Part Four - Memory Management. Chapter 8: Memory-Management Management Strategies. Chapter 8: Memory Management

Part Three - Memory Management. Chapter 8: Memory-Management Strategies

Chapter 9: Memory Management. Background

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 8: MEMORY

Chapter 8: Memory Management. Background Swapping Contiguous Allocation Paging Segmentation Segmentation with Paging

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

Memory Management. Memory Management

Chapter 9 Memory Management Main Memory Operating system concepts. Sixth Edition. Silberschatz, Galvin, and Gagne 8.1

Module 8: Memory Management

Module 9: Memory Management. Background. Binding of Instructions and Data to Memory

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition

Chapter 8: Memory- Management Strategies

Roadmap. Tevfik Koşar. CSC Operating Systems Spring Lecture - XII Main Memory - II. Louisiana State University

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

Chapter 8: Main Memory

Chapter 8: Memory Management

Chapter 8: Memory-Management Strategies

I.-C. Lin, Assistant Professor. Textbook: Operating System Principles 7ed CHAPTER 8: MEMORY

CS307: Operating Systems

Module 8: Memory Management

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts

Chapter 8: Memory Management

Chapter 8: Main Memory. Operating System Concepts 9 th Edition

6 - Main Memory EECE 315 (101) ECE UBC 2013 W2

Chapter 8: Main Memory

Chapter 8: Memory- Manage g me m nt n S tra r t a e t gie i s

Logical versus Physical Address Space

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

Goals of Memory Management

CSE 421/521 - Operating Systems Fall Lecture - XII Main Memory Management. Tevfik Koşar. University at Buffalo. October 18 th, 2012.

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure.

Memory Management (1) Memory Management

Memory Management (1) Memory Management. CPU vs. memory. No.8. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Memory Management. Memory Management

Memory Management william stallings, maurizio pizzonia - sistemi operativi

Memory Management. Contents: Memory Management. How to generate code? Background

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Chapters 9 & 10: Memory Management and Virtual Memory

Memory Management Cache Base and Limit Registers base limit Binding of Instructions and Data to Memory Compile time absolute code Load time

12: Memory Management

SHANDONG UNIVERSITY 1

Process. Memory Management

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Lecture 8 Memory Management Strategies (chapter 8)

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Memory Management. Memory Management Requirements

Chapter 8 Memory Management

CIS Operating Systems Contiguous Memory Allocation. Professor Qiang Zeng Spring 2018

Process. One or more threads of execution Resources required for execution

Process. One or more threads of execution Resources required for execution. Memory (RAM) Others

Main Memory Yi Shi Fall 2017 Xi an Jiaotong University

Chapter 9 Real Memory Organization and Management

Chapter 9 Real Memory Organization and Management

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018

Operating Systems (2INC0) 2017/18

Operating Systems Unit 6. Memory Management

Memory Management. Reading: Silberschatz chapter 9 Reading: Stallings. chapter 7 EEL 358

3. Memory Management

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1

Memory Management Basics

Memory Management. Memory

Memory Management. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

Memory Management Minsoo Ryu Real-Time Computing and Communications Lab. Hanyang University

Chapter 8 Main Memory

Memory Management. Dr. Yingwu Zhu

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University

Memory Management. (SGG, Chapter 08) Objectives. Memory Hierarchy. Outline. Instructor: Dr. Tongping Liu. To describe various memory hardware"

Chapter 7 Memory Management

UNIT III MEMORY MANAGEMENT

Preview. Memory Management

Lecture 7. Memory Management

Memory Management. COMP755 Advanced Operating Systems

Chapter 9 Memory Management

P r a t t hr h ee e : e M e M m e o m r o y y M a M n a a n g a e g m e e m n e t 8.1/72

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

CS399 New Beginnings. Jonathan Walpole

Main Memory. CISC3595, Spring 2015 X. Zhang Fordham University

Memory Management. Dr. Yingwu Zhu

8: Memory Management

Memory Management. Jo, Heeseung

Basic Memory Management. Basic Memory Management. Address Binding. Running a user program. Operating Systems 10/14/2018 CSC 256/456 1

Requirements, Partitioning, paging, and segmentation

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

Heap Management portion of the store lives indefinitely until the program explicitly deletes it C++ and Java new Such objects are stored on a heap

Transcription:

Operating systems Module 11 Main memory introduction Part 1 Tami Sorgente 1

MODULE 11 MAIN MEMORY INTRODUCTION Background Swapping Contiguous Memory Allocation Noncontiguous Memory Allocation o Segmentation o Paging Tami Sorgente 2

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 storage CPU can access directly Register access in one CPU clock (or less) Main memory can take many cycles, causing a stall Cache sits between main memory and CPU registers Protection of memory required to ensure correct operation Tami Sorgente 3

MEMORY-MANAGEMENT UNIT (MMU) Hardware device that at run time maps virtual/logical to physical address The user program deals with logical addresses; it never sees the real physical addresses o Execution-time binding occurs when reference is made to location in memory o Logical address bound to physical addresses Tami Sorgente 4

SCHEMATIC VIEW OF SWAPPING Tami Sorgente 5

CONTIGUOUS VS NONCONTIGUOUS OS OS base limit Free Free P1 P2 Free P1 P2 P1 P2 contiguous noncontiguous Tami Sorgente 6

CONTIGUOUS ALLOCATION Main memory must support both OS and user processes Contiguous allocation is one early method Main memory usually into two partitions: o o o Resident operating system, usually held in low memory with interrupt vector User processes then held in high memory Each process contained in single contiguous section of memory Tami Sorgente 7

DYNAMIC STORAGE-ALLOCATION PROBLEM First-fit: Allocate the first hole that is big enough Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size o Produces the smallest leftover hole Worst-fit: Allocate the largest hole; must also search entire list o Produces the largest leftover hole Tami Sorgente 8

CONTIGUOUS VS NONCONTIGUOUS OS OS base limit Free Free P1 P2 Free P1 P2 P1 P2 contiguous noncontiguous Tami Sorgente 9

FRAGMENTATION External Fragmentation total memory space exists to satisfy a request, but it is not contiguous Reduce external fragmentation by storage compaction o Shuffle memory contents to place all free memory together in one large block Internal Fragmentation allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used Tami Sorgente 10

SEGMENTATION A program is a collection of segments o A segment is a logical unit such as: main program procedure function method object local variables, global variables common block stack symbol table arrays segment 0 segment 1 segment 2 segment 3 segment 4 Tami Sorgente 11

SEGMENTATION variable size o units are smaller and have meaning noncontiguous map each segment separately Advantages: segments correspond to semantic (meaningful) units better protection (security) sharing and reliability Disadvantages: variable size unit of memory allocation. o First fit, best fit, worst fit External fragmentation Tami Sorgente 12

PAGING 0 1 2 3 4 5 6 7 Logical/virtual memory pages 0 1 1 4 2 3 3 7 4 5 6 7 Frame # Page table 0 1 Page 0 2 3 Page 2 4 Page 1 5 6 7 Page 3 8 9 10 11 12 13 14 Physical memory frames 13

PAGING noncontiguous Avoids external fragmentation Avoids problem of varying sized memory chunks Divide physical memory into fixed-sized blocks called frames Divide logical memory into blocks of same size called pages Keep track of all free frames Set up a page table to translate logical to physical addresses Backing store likewise split into pages Internal fragmentation Tami Sorgente 14

Operating systems Module 11 Main memory introduction PART 11 memory placement exercise Tami Sorgente 15

MEMORY PLACEMENT EXERCISE Job Size(KB) Time Units J1 500 3 J2 250 4 J3 200 5 J4 350 3 J5 60 5 J6 300 3 J7 400 2 Definitions Coalescing holes- merging holes to form one large hole Storage compaction ( garbage collection ) move all occupied areas of memory to one end Analyze execution of 7 jobs specified: Suppose main memory is 1 MB OS designed: First Fit strategy CPU switches job every time unit OS performs coalescing holes (cost 1 time unit) OS applies storage compaction every 20 time units When a new job is placed in memory it executes first How many time units are needed for completion of 7 jobs Tami Sorgente 16

MEMORY PLACEMENT EXERCISE Job Size(KB) Time Units J1 500 3 J2 250 4 J3 200 5 J4 350 3 J5 60 5 J6 300 3 J7 400 2 Suppose main memory is 1 MB First Fit strategy CPU switches job every time unit (adjacent holes) OS performs coalescing holes (cost 1 time unit) OS applies storage compaction every 20 time units Tami Sorgente 17

Job Size(KB) Time Units J1 500 3 J2 250 4 J3 200 5 J4 350 3 J5 60 5 J6 300 3 J7 400 2 Hole = 500 Hole = 90 Hole = 340 Hole = 250 Hole = 40 Hole = 50 Hole = 50 Hole = 50 Hole = 50 0 10 CH 15 17 18

Time 18: External fragmentation Time 20 to 24: Storage compaction Job Size(KB) Time Units J1 500 3 J2 250 4 J3 200 5 J4 350 3 J5 60 5 J6 300 3 J7 400 2 Hole = 350 Hole = 40 Hole = 40 Hole = 440 Hole = 50 Hole = 50 Hole = 40 SC SC SC SC CH CH 17 20 24 32 19