ITEC 352 Lecture 25 Memory(3). Review Questions RAM –What is the difference between register memory, cache memory, and main memory? –What connects the.

Slides:



Advertisements
Similar presentations
ITEC 352 Lecture 25 Memory(2). Review RAM –Why it isnt on the CPU –What it is made of –Building blocks to black boxes –How it is accessed –Problems with.
Advertisements

Part IV: Memory Management
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 13: Main Memory (Chapter 8)
ITEC 352 Lecture 27 Memory(4). Review Questions? Cache control –L1/L2  Main memory example –Formulas for hits.
CS 311 – Lecture 21 Outline Memory management in UNIX
Modified from Silberschatz, Galvin and Gagne Lecture 16 Chapter 8: Main Memory.
03/09/2007CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Memory Management CSCI 3753 Operating Systems Spring 2005 Prof. Rick Han.
Memory Organization.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Modified from Silberschatz, Galvin and Gagne Lecture 15 Chapter 8: Main Memory.
MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.
Lecture 9: SHELL PROGRAMMING (continued) Creating shell scripts!
A. Frank - P. Weisberg Operating Systems Real Memory Management.
Operating System Concepts
Silberschatz, Galvin and Gagne  Operating System Concepts Multistep Processing of a User Program User programs go through several steps before.
03/17/2008CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
03/05/2008CSCI 315 Operating Systems Design1 Memory Management Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Chapter 91 Memory Management Chapter 9   Review of process from source to executable (linking, loading, addressing)   General discussion of memory.
ITEC 325 Lecture 29 Memory(6). Review P2 assigned Exam 2 next Friday Demand paging –Page faults –TLB intro.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
Swapping and Contiguous Memory Allocation. Multistep Processing of a User Program User programs go through several steps before being run. Program components.
Lecture 13 L.Mohammad R.Alkafagee1.  The concept of a logical address space that is bound to a separate physical address space is central to proper memory.
Operating Systems Chapter 8
A genda for Today What is memory management Source code to execution Address binding Logical and physical address spaces Dynamic loading, dynamic linking,
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 8: Memory-Management Strategies Objectives To provide a detailed description.
OSes: 8. Mem. Mgmt. 1 Operating Systems v Objectives –describe some of the memory management schemes used by an OS so that several processes can be in.
Chapter 4 Storage Management (Memory Management).
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Silberschatz and Galvin  Operating System Concepts Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous.
CE Operating Systems Lecture 14 Memory management.
Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Basic Memory Management 1. Readings r Silbershatz et al: chapters
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Mono an multiprogramming.
CS6502 Operating Systems - Dr. J. Garrido Memory Management – Part 1 Class Will Start Momentarily… Lecture 8b CS6502 Operating Systems Dr. Jose M. Garrido.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 31 Memory Management.
Memory Management 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.
Slide 11-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 11.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
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.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition, Chapter 8: Memory- Management Strategies.
Main Memory CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Chapter 9: Memory Management
SLC/VER1.0/OS CONCEPTS/OCT'99
Real Memory Management
Main Memory Management
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.
Chapter 8: Main Memory.
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.
CSS 430: Operating Systems - Main Memory
Multistep Processing of a User Program
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
Memory Management Tasks
Chapter 8: Memory management
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 30 Syed Mansoor Sarwar
Memory management Explain how memory is managed in a typical modern computer system (virtual memory, paging and segmentation should be described.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
OPERATING SYSTEMS MEMORY MANAGEMENT BY DR.V.R.ELANGOVAN.
Presentation transcript:

ITEC 352 Lecture 25 Memory(3)

Review Questions RAM –What is the difference between register memory, cache memory, and main memory? –What connects the different types of memory together? –What are some of the different ways to handle what is in the cache?

Memory (3) Objectives Cache memory Intro to virtual memory

Memory (3) Performanc e of a cache Assume a program (instructions) is loaded into the memory from address 0 to 57. Also assume: cache access time: 80 ns and memory access time: 2500 ns. What is the performance when using a cache Memory address range Memory Cache

Memory (3) Performanc e of a cache What is the memory address of the first instruction accessed? –Address: 0 Is this in the cache? –Initially, cache is empty. Hence, no! So what do you do? –Depends on the policy Memory address range Memory Cache

Memory (3) Performanc e of a cache As the data is not in the cache, the block 0-16 is loaded into the slot1 of the cache. The next instruction is at address 1. –Is this in the cache? –Yes – so the next 15 instructions are in the cache Memory address range Memory Cache

Memory (3) Performanc e of cache Hence: EventLocation Time 1 miss ns 15 hits ns X 15 …

Memory (3) Hit Ratios and Effective Access Times Hit ratio and effective access time for single level cache: Hit ratios and effective access time for multi-level cache:

Memory (3) Multilevel caches As size of ICs have increased, packing density also has increased. –Multilevel caches have been developed Fastest level L1 is on the chip. –Usually data and instructions are kept separate on this cache. Called split cache. Level L2 and L3 are slower than L1 and are unified caches.

Memory (3) Question Lets say there are memory references to execute a process. –90 cause L1 misses and of these 10 cause L2 misses. –Let L1 hit time: 5 ns (this is the time to access a memory location if it is in the cache). –Let L2 hit time: 20 ns –Let the L2 miss time: 100 ns (time to access memory in the main memory). What is the effective access time to access a memory?

Memory (3) Summary so far … We have seen different types of memory elements and gone up the hierarchy of memory. –We have developed RAM, ROM, Registers and looked at Caches. Next: we will see how programs that we develop are allocated memory. Some terminology: –Process: any program in execution is called a process. E.g., A java program that you write is simply a program, unless you execute it. During its execution it becomes a process. There can be multiple processes of the same program.

Memory (3) Memory Allocation Two problems in memory allocation. –Processes must not have conflicts in memory they use. (must have separate memory). E.g., you wouldn’t want memory used by your process to be overwritten by that of another user. Solution: Relocatable Code –Small amount of physical memory (RAM) must be used to execute a large number of processes –(or execute large processes each of which exceed the size of RAM) –Solution: Virtual Memory.

Memory (3) Relocatable code and Virtual Memory Relocatable assembly code: processes must be able to reside in any portion of the physical memory. –Why ? Consider an operating system, where all executions of Microsoft Word must only reside at address 0x What would happen ? –Hence, compiled and assembled programs do not have fixed addresses allocated to them.  Virtual memory: use hard disk as an extension for RAM.  Intuition: processes are allocated memory in a special portion of the hard disk. They are loaded into RAM only when they are executing on the CPU

Memory (3) Relocatable code Program binary code, such that the addresses of the process address space can be changed dynamically. I.e. it doesn’t map to main memory It has it’s own memory space Operating system replaces with what it deems appropriate

Memory (3) Relocatable Code #include … int main() { int x = 10; return x; } : push %ebp BINARY CODE : mov %esp,%ebp : sub $0x8,%esp … : ret : nop 0x c : push %ebp 0x d : mov %esp,%ebp 0x f : sub $0x8,%esp … 0x c : ret 0x d : nop Compiler + assembler Compiler generates relocatable code: e.g., return instruction is 32 bytes away from beginning of code segment When process is created. The process is given addresses by OS Address called as logical address Address binding: binding each logical address to a location in physical memory Linking and loading

Memory (3) Relocatable Code #include … int main() { int x = 10; return x; } : push %ebp BINARY CODE : mov %esp,%ebp : sub $0x8,%esp … : ret : nop 0x c : push %ebp 0x d : mov %esp,%ebp 0x f : sub $0x8,%esp … 0x c : ret 0x d : nop Compiler + assembler Compiler generates relocatable code: e.g., return instruction is 32 bytes away from beginning of code segment When process is created. The process is given addresses by CPU. Address called as logical address Address binding: binding each logical address to a location in physical memory Linking and loading

Memory (3) Using a HD as memory © Image from Silberschatz and Galvin

Three types of memory addresses C program Compiler/Assembler Binary code (relocatable addresses)\ Aka linear addresses When program is Executed. CPU generated Logical Addresses Also called Virtual address Loader Logical Address Bound to Physical memory address Three types of addresses: linear address (addresses in compiled binaries), logical address (address in the virtual memory) and physical address (address in the RAM when a program is loaded).

Dynamic Relocation using relocation register: mapping logical to physical address. © Image from Silberschatz and Galvin

Memory (3) Virtual Memory (2) When a process is executed, the OS allocates memory for the process on the disk (usually 4 GB of memory is allocated). –This includes a code segment, data segment and program stack. –In UNIX, we usually call this portion of the disk as swap partition. Advantage: Process memory is not tied to the amount of RAM. However, for a CPU to execute a process, the process must be in the physical memory. –Hence, OSes provide methods to map process address space on virtual memory (called logical memory) to physical memory (memory addresses in RAM).

Memory (3) Summary Cache access Virtual memory