Teemu s Cheesecake Lecture 4: Memory management, virtual. (memory) Comp. Org II, Spring

Size: px
Start display at page:

Download "Teemu s Cheesecake Lecture 4: Memory management, virtual. (memory) Comp. Org II, Spring"

Transcription

1 Lecture 4 Teemu s Cheesecake Memory Management (Muistinhallinta) Stallings: Ch Memory management Swapping vs. virtual Hardware and software support Example: Pentium hand 0.5 sec (register) 1 sec (cache) Register, on-chip cache,, disk, and tape speeds relative to times locating cheese for the cheese cake you are baking... Europa refridge- (Jupiter) rator moon 10 sec 12 days () (disk) 4 years (tape) 2 Virtual Memory (virtuaalimuisti) Other Problems Often Solved with VM Problem: How can I make my (main) as big as my disk drive? Answer: Virtual keep only most probably referenced data in, and rest of it in disk - disk is much bigger and slower than - address in machine instruction may be different than address - need to have efficient address mapping - most of references are for data in joint solution with HW & SW If you want to have many processes in at the same time, how do you keep track of usage? How do you prevent one process from touching another process areas? What if a process needs more than available? 3 4 Memory Management Problem Partitioning How much for each process? Is it fixed amount during the process run time or can it vary during the run time? Where should that be? In a continuous or discontinuous area? Is the location the same during the run time or can it vary dynamically during the run time? How is that managed? How is that referenced? How much physical for each process? Static (fixed) partitioning (kiinteät partitiot, kiinteä ositus) Amount of physical determined at process creation time Continuous allocation for partition Dynamic partitioning (dynaamiset partitiot) Amount of physical given to a process varies in time - Due to process requirements (of this process) - Due to system (I.e., other processes) requirements 5 6 Comp. Org II, Spring

2 Static Partitioning Dynamic Partitioning Equal size - give everybody the same amount Fixed size - big enough for everybody - too much for most Need more? Can not run! Unequal size sizes predetermined Can not combine Variable size Size determined at process P2 P1 P4 Fig (a) [Sta06 ] Fig (b) [Sta06 ] P3 P4 Process must be able to run with varying amounts of main all of space is not in physical need some minimum amount of New process? If necessary reduce amount of for some (lower priority) processes Not enough for some process? reduce amount of for some (lower priority) processes kick (swap) out some (lower priority) process creation time P1 Fig [Sta06 ] 7 8 Fragmentation (pirstoutuminen) Fig [Sta06 ] Internal fragmentation (sisäinen pirstoutuminen) unused inside allocated block e.g., equal size fixed partitions Fig (a) [Sta06 ] External fragmentation (ulkoinen pirstoutuminen) enough free, but it is splintered as many unalloca blocks e.g., unequal size partitions or dynamic fixed size (variable Fig (b) [Sta06 ] size) partitions Fig [Sta06 ] 9 10 Address Mapping (osoitteen muunnos) Pascal, Java: while (...) X := Y+Z; Textual machine language: Symbolic Assembler: loop: LOAD R1, Y ADD R1, Z STORE R1, X Address Mapping logical address Textual machine language: 1312: LOAD R1, ? Execution time: 1312: LOAD R1, 2510 ADD R1, 2514 STORE R1, 2600 (addresses relative to 0) Execution time: : LOAD R1, ADD R1, ADD R1, (real, actual!) : LOAD R1, or : LOAD R1, 2510?? physical address (constant?) logical addr - Want: R1 Mem[102510] or Mem[2510]? - Who makes the mapping? When? Comp. Org II, Spring

3 Address Mapping, address translation At program load time Loader (lataaja) Static address binding (staattinen osoitteiden sidonta) At program execution time CPU With every instruction Dynamic address binding (dynaaminen osoitteiden sidonta) Swapping (heittovaihto) Virtual Swapping (heittovaihto) Process has continuous area Process fully in or on disk More on OS course Process control block, PCB (prosessinkuvaaja) always in Address translation at execution time (ajonaikainen) Logical address physical address Memory management unit, MMU, - hardware support Base and limit registers (Kanta- ja rajarekisteri) Bounds exceeded -interrupt Operating System (OS) (käyttöjärjestelmä) Bookkeeping about unallocated (free) areas Process swapping between and disk Process switch: set new values to base and limit registers Illegal (unauthorized) access: kill the process Virtual Memory Implementation (Virtuaalimuistitoteutus) Base and Limit Registers Methods Base and limit registers (kanta- ja rajarekisterit) Segmentation (segmentointi) Paging (sivutus) Segmented paging, multilevel paging Hardware support MMU - Memory Management Unit - Part of processor - Varies with different methods Sets limits on what types of virtual (methods) can be implemented using this HW Continuous partitions One or more (4?) per process May have separate base and limit registers - Code, data, shared data, etc - By default, or given explicitly in each mem. ref. BASE and LIMIT registers in MMU All addresses logical in machine instructions Exec. time address mapping for address (x): - Check: 0 x < LIMIT - Physical address: BASE +x From Comp. Org I Virtual OS course content Load A Virtual Memory: Paging (sivutus) Only needed chunks in the, no need to be contiguous Demand paging (Tarvenouto) Chunk size? Paging most common here only paging Fixed size = Paging Variable size = Segmentation Combined = Paged segments OS bookkeeping (KJ:n kirjanpito) Page frame (sivutilataulu) - Which frames are free, which are occupied Each process has its own (sivutaulu) - Page in or on disk? Presence-bit - In, which frame contains this? - Other control? Bits: Modified, Referenced OS loads process A from disk Program: s Memory: frames Process A in main (Sta06 Fig 8.15) Comp. Org II, Spring

4 (Sta06 Fig 8.16) Address Mapping with Paging VM (Sivuttavan virtuaalimuistin osoitteenmuunnos) Page register Check for valid entry Paged Address Translation Virtual address : 1: 2: Page 0 rwx 65 1 rw 14 1 rw 55.. Valid entry Access rights Page frame Access type r Check access rights r {rw} (virt. mem. used to solve protection problem) Physical address Page fault interrupt Stop execution Initiate reading 1 from disk Schedule next process to run I/O interrupt Page 1 read, update Make orig. process ready-to-run Page register Check for valid entry: not valid! Page Fault Virtual address : 1: 2: Page 0 rwx rw w rw 55.. Schedule orig. process again, at the same instruction Access type r Check access rights r {rw} Physical address Virtual : Translation Lookaside Buffer (TLB) (osoitteenmuunnospuskuri) Address translation for each reference, at least once for each instruction Page elements in = extra (even more) access? Too slow! Solution Principle of Locality! Page element needed soon again Store recently used elements (of this process) on CPU s management unit TLB, translation lookaside Buffer Just like cache Fast set of registers (Pentium: 32 registers) Associative search Hit ratio (Osumatodennäköisyys) 99.9%? (Almost always!) Correct address mapping found Physical address 0x00B6C8E6 046 ReadW I2, 0xAB00C7DA : tag index AB00C7D A.? = Match Example: Direct Mapped 16-entry TLB offset 0111: 1000: 1001: 1010:. tag frame AB00C7D 00B6C8E6 Translation Lookaside Buffer (TLB) Hit on TLB? address translation is in TLB - real fast Miss on TLB? must read entry from takes time not much, just a reference - Entry might be in cache! cpu waits idle until it is done Just like normal cache, but for address mapping implemented just like cache instead of cache line data have physical address split TLB? 1 or 2 levels? Comp. Org II, Spring

5 Page Fault? (Sivunpuutoskeskeytys) Process switch (minimum 2) (Sta06 Fig 8.18) Virtual Hardware support: MMU and its special registers PTR ( register) - Physical start address of process (copied from PCB process control block) TLB (translation lookaside buffer) - Caches entries from earlier address mappings Page fault interrupt Updating reference and modified bits Process switch PTR Physical start address of process Invalidate old TLB content (process specific) - Each location has valid bit - Changed elements back to ( cache block ) CPU instr mem.addr TLB Memory Organisation regs data Memory TLB and cache Page entry can be found from cache! cache Bus Disk (Sta06 Fig 8.19) TLB vs. Cache TLB Miss CPU waits idling HW implementation Invisible to process Data is copied from to TLB from data from cache? Delay 4 (or 2 or 8?) clock cycles Cache Miss CPU waits idling HW implementation Invisible to process Data is copied from to cache from data Delay 4 (or 2 or 8?) clock cycles TLB Miss TLB Misses vs. Page Faults CPU waits idling HW implementation Data is copied from to TLB (or from cache) Delay 1-4 (?) clock cycles Page Fault Process is suspended and cpu executes some other processes SW implementation Data is copied from disk to Delay 1-4 (?) clock cycles Comp. Org II, Spring

6 Replacement policy (Korvauspolitiikka) Which should be replaced, when there is not enough free frames in main? OS course Local/ global policy Select from the processes own s Select from all s (of all processes) Algorithm Clock, Second change, LRU, MMU At access set Referenced=1 (read) set Modified=1, content changed (write) OS Reset Referenced and Modified periodically Replace a where R=0, M=0 M=1 write the to disk before reusing the frame (Sta06 Fig 8.17 ) Correct of current process? Inverted (käänteinen sivutaulu) Just one shared inverted MMU: PTR ( reg), PidR (process id register), TLB ~ PowerPC ~ UltraSPARC ~ IA Hierarchical (monitasoinen sivutaulu) Several systems allow large virtual address space Page split to s, some of it on the disk Top level of fits to one, always in 32b osoite 1 K items (= 1024 = 2 10 ) = Page Dir K * 1K = 1M items Virtual Memory Policies Fetch policy (noutopolitiikka) demand paging: fetch only when needed 1st time working set: keep all needed s in prefetch: guess and start fetch early Placement policy (sijoituspolitiikka) any frame for d VM Replacement policy (poistopolitiikka) local, consider s just for this process for replacement global, consider also s for all other processes dirty s must be written to disk (likaiset, muutetut sivut) (Sta05 - OS Fig 8.4) Computer Organization II Pentium support for management Example Pentium (IA-32) See also Tan06 35 Unsegmented und, max 2 32 = 4 GB Virtual address = physical address Efficient feasible in real-time systems Unsegmented d (Sivuttava), max 4 GB Linear address space (lineaarinen osoiteavaruus) Page and frame size: 4KB or 4MB Protection frame based Segmented und (Segmentoiva), max 2 48 = 64 TB Several segments several linear spaces Protection segment based Segmented d (Sivuttava segmentointi), max 64 TB Memory management using s and frames Protection segment based 36 Comp. Org II, Spring

7 Pentium: Address translation Pentium: Address translation Segment selector Global / Local Table Segment number - Global/Local Descriptor Table (GDT/LDT) CS/DS selectors for code/data segments (Tan06 Fig 6-12, 6-13) base Segment descriptor Get from GDT or LDT and store to registers on MMU (Sta06 Fig 8.21) If Paging=Enabled, use s else linear address = physical address (OS, f.ex. Devide drivers?) Control registers (see further in the course book) Pentium: Segment Desriptor (segmenttikuvaaja) Pentium: Page Table (sivutaulu) (Sta09 Table 8.5) (Sta09 Table 8.5) Computer Organization II ARM Memory System Overview Example ARM (Sta09 Fig 8.22) Comp. Org II, Spring

8 ARM Virtual Memory Address Translation for Small Pages - Diagram Single L1 4K 32-bit entries Each L1 entry points to L2 Each L bit entries Each L2 entry points to 4-KB in main 32-bit virtual address 12 bit - L1 8 bit - L2 12 bit - offset (= index) (Sta09 Fig 8.23) ARMv6 Memory Management Formats Second level : - Large entry replicated 16 times -Mix of small and large s allowed (Sta09 Fig 8.24) Overlapping 4 bits Hennessy-Patterson:Computer Architecture, Fig 5.47 Alpha AXP Instr. TLB fully assoc, 12 entries Instr. CACHE direct mapped, 8 KB, 256 lines (a 32B) Unified Level 2 CACHE 2 MB, 64K lines (a 32B) direct mapped, write-back Data TLB fully assoc, 32 entries Data CACHE direct mapped, 8 KB, 256 lines Main Memory Disk 45 Review Questions / Kertauskysymyksiä What hardware support is needed for virtual implementation? Differences of paging and segmentation? Why to combine paging and segmentation? Relationship of TLB and cache? Similarities, differences? Mitä laitteistotason tukea tarvitaan VM:n toteuttamiseksi? Miten sivutus ja segmentointi eroavat toisistaan? Miksi ne joskus yhdistetään? Miten TLB ja välimuisti suhtautuvat toisiinsa? 46 Comp. Org II, Spring

Teemu s Cheesecake. Lecture 4: Memory management, virtual (memory) Comp. Org II, Spring Memory Management (Muistinhallinta)

Teemu s Cheesecake. Lecture 4: Memory management, virtual (memory) Comp. Org II, Spring Memory Management (Muistinhallinta) Lecture 4 Memory Management (Muistinhallinta) Stallings: Ch 8.3-8.6 Memory management Swapping vs. virtual Hardware and software support Example: Pentium Teemu s Cheesecake hand table Register, on-chip

More information

Memory Management (Muistinhallinta)

Memory Management (Muistinhallinta) Lecture 4 Memory Management (Muistinhallinta) Stallings: Ch 8.3-8.6 Memory management Swapping vs. virtual memory Hardware and software support Example: Pentium Teemu s Cheesecake hand table Register,

More information

Virtual Memory (VM) Ch Copyright Teemu Kerola Teemu s Cheesecake

Virtual Memory (VM) Ch Copyright Teemu Kerola Teemu s Cheesecake Virtual Memory (VM) Ch 8.3 Memory Management Address Translation Paging Hardware Support VM and Cache 1 Teemu s Cheesecake hand table Register, on-chip cache, memory, disk, and tape speeds relative to

More information

Virtual Memory (VM) Ch 7.3

Virtual Memory (VM) Ch 7.3 Virtual Memory (VM) Ch 7.3 Memory Management Address Translation Paging Hardware Support VM and Cache 1 Teemu s Cheesecake hand table Register, on-chip cache, memory, disk, and tape speeds relative to

More information

Teemu s Cheesecake. Virtual Memory (VM) Ch 7.3. Other Problems Often Solved with VM (3) Virtual Memory Ch 7.3

Teemu s Cheesecake. Virtual Memory (VM) Ch 7.3. Other Problems Often Solved with VM (3) Virtual Memory Ch 7.3 Virtual Memory (VM) Ch 7.3 Memory Management Address Translation Paging Hardware Support VM and Cache Teemu s Cheesecake hand 0.5 sec (register) 1 sec (cache) Register, on-chip cache, memory, disk, and

More information

Registers Cache Main memory Magnetic disk Magnetic tape

Registers Cache Main memory Magnetic disk Magnetic tape Operating Systems: Memory management Mon 14.9.2009 Tiina Niklander Memory Management Programmer wants memory to be Indefinitely large Indefinitely fast Non volatile Memory hierarchy small amount of fast,

More information

Operating Systems, Fall

Operating Systems, Fall Operating Systems: Memory management Fall 2008 Tiina Niklander Memory Management Programmer wants memory to be Indefinitely large Indefinitely fast Non volatile Memory hierarchy Memory manager handles

More information

Operating Systems, Fall

Operating Systems, Fall Operating Systems: Memory management Fall 2008 Basic Memory Management: One program Monoprogramming without Swapping or Paging Tiina Niklander No memory abstraction, no address space, just an operating

More information

Internal Memory Cache Stallings: Ch 4, Ch 5 Key Characteristics Locality Cache Main Memory

Internal Memory Cache Stallings: Ch 4, Ch 5 Key Characteristics Locality Cache Main Memory Lecture 3 Internal Memory Cache Stallings: Ch 4, Ch 5 Key Characteristics Locality Cache Main Memory Key Characterics of Memories / Storage (Sta06 Table 4.1) 26.1.2010 2 Goals I want my memory lightning

More information

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner CPS104 Computer Organization and Programming Lecture 16: Virtual Memory Robert Wagner cps 104 VM.1 RW Fall 2000 Outline of Today s Lecture Virtual Memory. Paged virtual memory. Virtual to Physical translation:

More information

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory CPS 104 Computer Organization and Programming Lecture 20: Virtual Nov. 10, 1999 Dietolf (Dee) Ramm http://www.cs.duke.edu/~dr/cps104.html CPS 104 Lecture 20.1 Outline of Today s Lecture O Virtual. 6 Paged

More information

Operating Systems, Fall Lecture 5 1. Overhead due to page table and internal fragmentation. Tbl 8.2 [Stal05] 4.

Operating Systems, Fall Lecture 5 1. Overhead due to page table and internal fragmentation. Tbl 8.2 [Stal05] 4. Paging: design and implementation issues Effect of page size More small pages to the same memory space References from large pages more probable to go to a page not yet in memory References from small

More information

Operating Systems, Fall Lecture 5 1

Operating Systems, Fall Lecture 5 1 Paging: design and implementation issues 1 Effect of page size More small pages to the same memory space References from large pages more probable to go to a page not yet in memory References from small

More information

Virtual Memory. Virtual Memory

Virtual Memory. Virtual Memory Virtual Memory Virtual Memory Main memory is cache for secondary storage Secondary storage (disk) holds the complete virtual address space Only a portion of the virtual address space lives in the physical

More information

Page Size Page Size Design Issues

Page Size Page Size Design Issues Paging: design and implementation issues 1 Effect of page size More small pages to the same memory space References from large pages more probable to go to a page not yet in memory References from small

More information

Memory Hierarchy and Cache Ch 4-5. Memory Hierarchy Main Memory Cache Implementation

Memory Hierarchy and Cache Ch 4-5. Memory Hierarchy Main Memory Cache Implementation Memory Hierarchy and Cache Ch 4-5 Memory Hierarchy Main Memory Cache Implementation 1 Teemu s Cheesecake hand table Register, on-chip cache, memory, disk, and tape speeds relative to times locating cheese

More information

Memory Hierarchy and Cache Ch 4-5

Memory Hierarchy and Cache Ch 4-5 Memory Hierarchy and Cache Ch 4-5 Memory Hierarchy Main Memory Cache Implementation 1 Teemu s Cheesecake hand table Register, on-chip cache, memory, disk, and tape speeds relative to times locating cheese

More information

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18

PROCESS VIRTUAL MEMORY. CS124 Operating Systems Winter , Lecture 18 PROCESS VIRTUAL MEMORY CS124 Operating Systems Winter 2015-2016, Lecture 18 2 Programs and Memory Programs perform many interactions with memory Accessing variables stored at specific memory locations

More information

1. Creates the illusion of an address space much larger than the physical memory

1. Creates the illusion of an address space much larger than the physical memory Virtual memory Main Memory Disk I P D L1 L2 M Goals Physical address space Virtual address space 1. Creates the illusion of an address space much larger than the physical memory 2. Make provisions for

More information

Operating Systems, Fall

Operating Systems, Fall Policies and methods Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka

More information

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory

Multi-Process Systems: Memory (2) Memory & paging structures: free frames. Memory & paging structures. Physical memory Multi-Process Systems: Memory (2) What we will learn A detailed description of various ways of organizing memory Discuss various memory-management techniques, including paging and segmentation To provide

More information

Week 2: Tiina Niklander

Week 2: Tiina Niklander Virtual memory Operations and policies Chapters 3.4. 3.6 Week 2: 17.9.2009 Tiina Niklander 1 Policies and methods Fetch policy (Noutopolitiikka) When to load page to memory? Placement policy (Sijoituspolitiikka

More information

CS 61C: Great Ideas in Computer Architecture. Virtual Memory

CS 61C: Great Ideas in Computer Architecture. Virtual Memory CS 61C: Great Ideas in Computer Architecture Virtual Memory Instructor: Justin Hsia 7/30/2012 Summer 2012 Lecture #24 1 Review of Last Lecture (1/2) Multiple instruction issue increases max speedup, but

More information

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015

Operating Systems. 09. Memory Management Part 1. Paul Krzyzanowski. Rutgers University. Spring 2015 Operating Systems 09. Memory Management Part 1 Paul Krzyzanowski Rutgers University Spring 2015 March 9, 2015 2014-2015 Paul Krzyzanowski 1 CPU Access to Memory The CPU reads instructions and reads/write

More information

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1

Virtual Memory. Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Patterson & Hennessey Chapter 5 ELEC 5200/6200 1 Virtual Memory Use main memory as a cache for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs

More information

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

Lecture 21: Virtual Memory. Spring 2018 Jason Tang Lecture 21: Virtual Memory Spring 2018 Jason Tang 1 Topics Virtual addressing Page tables Translation lookaside buffer 2 Computer Organization Computer Processor Memory Devices Control Datapath Input Output

More information

Memory and multiprogramming

Memory and multiprogramming Memory and multiprogramming COMP342 27 Week 5 Dr Len Hamey Reading TW: Tanenbaum and Woodhull, Operating Systems, Third Edition, chapter 4. References (computer architecture): HP: Hennessy and Patterson

More information

Another View of the Memory Hierarchy. Lecture #25 Virtual Memory I Memory Hierarchy Requirements. Memory Hierarchy Requirements

Another View of the Memory Hierarchy. Lecture #25 Virtual Memory I Memory Hierarchy Requirements. Memory Hierarchy Requirements CS61C L25 Virtual I (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #25 Virtual I 27-8-7 Scott Beamer, Instructor Another View of the Hierarchy Thus far{ Next: Virtual { Regs Instr.

More information

Chapter 8. Virtual Memory

Chapter 8. Virtual Memory Operating System Chapter 8. Virtual Memory Lynn Choi School of Electrical Engineering Motivated by Memory Hierarchy Principles of Locality Speed vs. size vs. cost tradeoff Locality principle Spatial Locality:

More information

Memory Hierarchies 2009 DAT105

Memory Hierarchies 2009 DAT105 Memory Hierarchies Cache performance issues (5.1) Virtual memory (C.4) Cache performance improvement techniques (5.2) Hit-time improvement techniques Miss-rate improvement techniques Miss-penalty improvement

More information

Memory Hierarchy Requirements. Three Advantages of Virtual Memory

Memory Hierarchy Requirements. Three Advantages of Virtual Memory CS61C L12 Virtual (1) CS61CL : Machine Structures Lecture #12 Virtual 2009-08-03 Jeremy Huddleston Review!! Cache design choices: "! Size of cache: speed v. capacity "! size (i.e., cache aspect ratio)

More information

Operating Systems, Fall Lecture 5, Tiina Niklander 1

Operating Systems, Fall Lecture 5, Tiina Niklander 1 Paging: Design issues, Segmentation Page Fault Handling more details 1. Hardware traps to kernel 2. General registers saved 3. OS determines which virtual page needed 4. OS checks validity of address,

More information

CS152 Computer Architecture and Engineering Lecture 18: Virtual Memory

CS152 Computer Architecture and Engineering Lecture 18: Virtual Memory CS152 Computer Architecture and Engineering Lecture 18: Virtual Memory March 22, 1995 Dave Patterson (patterson@cs) and Shing Kong (shingkong@engsuncom) Slides available on http://httpcsberkeleyedu/~patterson

More information

Virtual Memory - Objectives

Virtual Memory - Objectives ECE232: Hardware Organization and Design Part 16: Virtual Memory Chapter 7 http://www.ecs.umass.edu/ece/ece232/ Adapted from Computer Organization and Design, Patterson & Hennessy Virtual Memory - Objectives

More information

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization Requirements Relocation Memory management ability to change process image position Protection ability to avoid unwanted memory accesses Sharing ability to share memory portions among processes Logical

More information

CS162 - Operating Systems and Systems Programming. Address Translation => Paging"

CS162 - Operating Systems and Systems Programming. Address Translation => Paging CS162 - Operating Systems and Systems Programming Address Translation => Paging" David E. Culler! http://cs162.eecs.berkeley.edu/! Lecture #15! Oct 3, 2014!! Reading: A&D 8.1-2, 8.3.1. 9.7 HW 3 out (due

More information

Operating System Support

Operating System Support Operating System Support Objectives and Functions Convenience Making the computer easier to use Efficiency Allowing better use of computer resources Layers and Views of a Computer System Operating System

More information

CS3350B Computer Architecture

CS3350B Computer Architecture CS335B Computer Architecture Winter 25 Lecture 32: Exploiting Memory Hierarchy: How? Marc Moreno Maza wwwcsduwoca/courses/cs335b [Adapted from lectures on Computer Organization and Design, Patterson &

More information

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip Reducing Hit Times Critical Influence on cycle-time or CPI Keep L1 small and simple small is always faster and can be put on chip interesting compromise is to keep the tags on chip and the block data off

More information

MEMORY MANAGEMENT/1 CS 409, FALL 2013

MEMORY MANAGEMENT/1 CS 409, FALL 2013 MEMORY MANAGEMENT Requirements: Relocation (to different memory areas) Protection (run time, usually implemented together with relocation) Sharing (and also protection) Logical organization Physical organization

More information

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

Memory management. Last modified: Adaptation of Silberschatz, Galvin, Gagne slides for the textbook Applied Operating Systems Concepts Memory management Last modified: 26.04.2016 1 Contents Background Logical and physical address spaces; address binding Overlaying, swapping Contiguous Memory Allocation Segmentation Paging Structure of

More information

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems

Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems Topics: Memory Management (SGG, Chapter 08) 8.1, 8.2, 8.3, 8.5, 8.6 CS 3733 Operating Systems Instructor: Dr. Turgay Korkmaz Department Computer Science The University of Texas at San Antonio Office: NPB

More information

CHAPTER 4 MEMORY HIERARCHIES TYPICAL MEMORY HIERARCHY TYPICAL MEMORY HIERARCHY: THE PYRAMID CACHE PERFORMANCE MEMORY HIERARCHIES CACHE DESIGN

CHAPTER 4 MEMORY HIERARCHIES TYPICAL MEMORY HIERARCHY TYPICAL MEMORY HIERARCHY: THE PYRAMID CACHE PERFORMANCE MEMORY HIERARCHIES CACHE DESIGN CHAPTER 4 TYPICAL MEMORY HIERARCHY MEMORY HIERARCHIES MEMORY HIERARCHIES CACHE DESIGN TECHNIQUES TO IMPROVE CACHE PERFORMANCE VIRTUAL MEMORY SUPPORT PRINCIPLE OF LOCALITY: A PROGRAM ACCESSES A RELATIVELY

More information

Chapter 8: Memory-Management Strategies

Chapter 8: Memory-Management Strategies Chapter 8: Memory-Management Strategies Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and

More information

Modern Computer Architecture

Modern Computer Architecture Modern Computer Architecture Lecture3 Review of Memory Hierarchy Hongbin Sun 国家集成电路人才培养基地 Xi an Jiaotong University Performance 1000 Recap: Who Cares About the Memory Hierarchy? Processor-DRAM Memory Gap

More information

Chapter 5 Memory Hierarchy Design. In-Cheol Park Dept. of EE, KAIST

Chapter 5 Memory Hierarchy Design. In-Cheol Park Dept. of EE, KAIST Chapter 5 Memory Hierarchy Design In-Cheol Park Dept. of EE, KAIST Why cache? Microprocessor performance increment: 55% per year Memory performance increment: 7% per year Principles of locality Spatial

More information

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency William Stallings Computer Organization and Architecture 7 th Edition Chapter 8 Operating System Support Objectives and Functions Convenience Making the computer easier to use Efficiency Allowing better

More information

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan

SE-292 High Performance Computing. Memory Hierarchy. R. Govindarajan SE-292 High Performance Computing Memory Hierarchy R. Govindarajan govind@serc Reality Check Question 1: Are real caches built to work on virtual addresses or physical addresses? Question 2: What about

More information

Main Memory (Fig. 7.13) Main Memory

Main Memory (Fig. 7.13) Main Memory Main Memory (Fig. 7.13) CPU CPU CPU Cache Multiplexor Cache Cache Bus Bus Bus Memory Memory bank 0 Memory bank 1 Memory bank 2 Memory bank 3 Memory b. Wide memory organization c. Interleaved memory organization

More information

CS 333 Introduction to Operating Systems. Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University

CS 333 Introduction to Operating Systems. Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University CS 333 Introduction to Operating Systems Class 11 Virtual Memory (1) Jonathan Walpole Computer Science Portland State University Virtual addresses Virtual memory addresses (what the process uses) Page

More information

Chapter 8 Memory Management

Chapter 8 Memory Management Chapter 8 Memory Management Da-Wei Chang CSIE.NCKU Source: Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Operating System Concepts", 9th Edition, Wiley. 1 Outline Background Swapping Contiguous

More information

Handout 4 Memory Hierarchy

Handout 4 Memory Hierarchy Handout 4 Memory Hierarchy Outline Memory hierarchy Locality Cache design Virtual address spaces Page table layout TLB design options (MMU Sub-system) Conclusion 2012/11/7 2 Since 1980, CPU has outpaced

More information

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES

CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES CHAPTER 8 - MEMORY MANAGEMENT STRATEGIES OBJECTIVES Detailed description of various ways of organizing memory hardware Various memory-management techniques, including paging and segmentation To provide

More information

Virtual Memory. control structures and hardware support

Virtual Memory. control structures and hardware support Virtual Memory control structures and hardware support 1 Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time A process may be swapped in and

More information

ECE 571 Advanced Microprocessor-Based Design Lecture 12

ECE 571 Advanced Microprocessor-Based Design Lecture 12 ECE 571 Advanced Microprocessor-Based Design Lecture 12 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 1 March 2018 HW#6 will be posted Project will be coming up Announcements

More information

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck Main memory management CMSC 411 Computer Systems Architecture Lecture 16 Memory Hierarchy 3 (Main Memory & Memory) Questions: How big should main memory be? How to handle reads and writes? How to find

More information

Virtual Memory Virtual memory first used to relive programmers from the burden of managing overlays.

Virtual Memory Virtual memory first used to relive programmers from the burden of managing overlays. CSE420 Virtual Memory Prof. Mokhtar Aboelaze York University Based on Slides by Prof. L. Bhuyan (UCR) Prof. M. Shaaban (RIT) Virtual Memory Virtual memory first used to relive programmers from the burden

More information

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

Chapter 8: Main Memory. Operating System Concepts 9 th Edition Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information

EITF20: Computer Architecture Part 5.1.1: Virtual Memory

EITF20: Computer Architecture Part 5.1.1: Virtual Memory EITF20: Computer Architecture Part 5.1.1: Virtual Memory Liang Liu liang.liu@eit.lth.se 1 Outline Reiteration Cache optimization Virtual memory Case study AMD Opteron Summary 2 Memory hierarchy 3 Cache

More information

CIS Operating Systems Memory Management Address Translation for Paging. Professor Qiang Zeng Spring 2018

CIS Operating Systems Memory Management Address Translation for Paging. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems Memory Management Address Translation for Paging Professor Qiang Zeng Spring 2018 Previous class What is logical address? Who use it? Describes a location in the logical memory

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel

More information

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

CHAPTER 8: MEMORY MANAGEMENT. By I-Chen Lin Textbook: Operating System Concepts 9th Ed. CHAPTER 8: MEMORY MANAGEMENT By I-Chen Lin Textbook: Operating System Concepts 9th Ed. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the

More information

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College

CISC 7310X. C08: Virtual Memory. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 3/22/2018 CUNY Brooklyn College CISC 7310X C08: Virtual Memory Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/22/2018 CUNY Brooklyn College 1 Outline Concepts of virtual address space, paging, virtual page,

More information

CIS Operating Systems Memory Management Address Translation. Professor Qiang Zeng Fall 2017

CIS Operating Systems Memory Management Address Translation. Professor Qiang Zeng Fall 2017 CIS 5512 - Operating Systems Memory Management Address Translation Professor Qiang Zeng Fall 2017 Outline Fixed partitions Dynamic partitions Con$guous alloca$on: Each process occupies a con$guous memory

More information

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation

The Virtual Memory Abstraction. Memory Management. Address spaces: Physical and Virtual. Address Translation The Virtual Memory Abstraction Memory Management Physical Memory Unprotected address space Limited size Shared physical frames Easy to share data Virtual Memory Programs are isolated Arbitrary size All

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and 64-bit Architectures Example:

More information

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management

CSE 120. Translation Lookaside Buffer (TLB) Implemented in Hardware. July 18, Day 5 Memory. Instructor: Neil Rhodes. Software TLB Management CSE 120 July 18, 2006 Day 5 Memory Instructor: Neil Rhodes Translation Lookaside Buffer (TLB) Implemented in Hardware Cache to map virtual page numbers to page frame Associative memory: HW looks up in

More information

Agenda. CS 61C: Great Ideas in Computer Architecture. Virtual Memory II. Goals of Virtual Memory. Memory Hierarchy Requirements

Agenda. CS 61C: Great Ideas in Computer Architecture. Virtual Memory II. Goals of Virtual Memory. Memory Hierarchy Requirements CS 61C: Great Ideas in Computer Architecture Virtual II Guest Lecturer: Justin Hsia Agenda Review of Last Lecture Goals of Virtual Page Tables Translation Lookaside Buffer (TLB) Administrivia VM Performance

More information

CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8)

CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8) CS5460: Operating Systems Lecture 14: Memory Management (Chapter 8) Important from last time We re trying to build efficient virtual address spaces Why?? Virtual / physical translation is done by HW and

More information

Chapter 9 Memory Management

Chapter 9 Memory Management Contents 1. Introduction 2. Computer-System Structures 3. Operating-System Structures 4. Processes 5. Threads 6. CPU Scheduling 7. Process Synchronization 8. Deadlocks 9. Memory Management 10. Virtual

More information

Memory Management. Dr. Yingwu Zhu

Memory Management. Dr. Yingwu Zhu Memory Management Dr. Yingwu Zhu Big picture Main memory is a resource A process/thread is being executing, the instructions & data must be in memory Assumption: Main memory is infinite Allocation of memory

More information

ECE4680 Computer Organization and Architecture. Virtual Memory

ECE4680 Computer Organization and Architecture. Virtual Memory ECE468 Computer Organization and Architecture Virtual Memory If I can see it and I can touch it, it s real. If I can t see it but I can touch it, it s invisible. If I can see it but I can t touch it, it

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 16: Memory Management and Paging Announcement Homework 2 is out To be posted on ilearn today Due in a week (the end of Feb 19 th ). 2 Recap: Fixed

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 29: an Introduction to Virtual Memory Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Virtual memory used to protect applications

More information

ECE 571 Advanced Microprocessor-Based Design Lecture 13

ECE 571 Advanced Microprocessor-Based Design Lecture 13 ECE 571 Advanced Microprocessor-Based Design Lecture 13 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 21 March 2017 Announcements More on HW#6 When ask for reasons why cache

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Cache Performance

Cache Performance and Memory Management: From Absolute Addresses to Demand Paging. Cache Performance 6.823, L11--1 Cache Performance and Memory Management: From Absolute Addresses to Demand Paging Asanovic Laboratory for Computer Science M.I.T. http://www.csg.lcs.mit.edu/6.823 Cache Performance 6.823,

More information

Address spaces and memory management

Address spaces and memory management Address spaces and memory management Review of processes Process = one or more threads in an address space Thread = stream of executing instructions Address space = memory space used by threads Address

More information

Operating Systems and Computer Networks. Memory Management. Dr.-Ing. Pascal A. Klein

Operating Systems and Computer Networks. Memory Management. Dr.-Ing. Pascal A. Klein Operating Systems and Computer Networks Memory Management pascal.klein@uni-due.de Alexander Maxeiner, M.Sc. Faculty of Engineering Agenda 1 Swapping 2 Segmentation Algorithms 3 Memory Allocation 4 Virtual

More information

CS 5523 Operating Systems: Memory Management (SGG-8)

CS 5523 Operating Systems: Memory Management (SGG-8) CS 5523 Operating Systems: Memory Management (SGG-8) Instructor: Dr Tongping Liu Thank Dr Dakai Zhu, Dr Palden Lama, and Dr Tim Richards (UMASS) for providing their slides Outline Simple memory management:

More information

Computer Architecture. Lecture 8: Virtual Memory

Computer Architecture. Lecture 8: Virtual Memory Computer Architecture Lecture 8: Virtual Memory Dr. Ahmed Sallam Suez Canal University Spring 2015 Based on original slides by Prof. Onur Mutlu Memory (Programmer s View) 2 Ideal Memory Zero access time

More information

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

File Systems. OS Overview I/O. Swap. Management. Operations CPU. Hard Drive. Management. Memory. Hard Drive. CSI3131 Topics. Structure. File Systems I/O Management Hard Drive Management Virtual Memory Swap Memory Management Storage and I/O Introduction CSI3131 Topics Process Management Computing Systems Memory CPU Peripherals Processes

More information

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time.

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time. Memory Management To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time. Basic CPUs and Physical Memory CPU cache Physical memory

More information

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables

Outline. V Computer Systems Organization II (Honors) (Introductory Operating Systems) Advantages of Multi-level Page Tables Outline V22.0202-001 Computer Systems Organization II (Honors) (Introductory Operating Systems) Lecture 15 Memory Management (cont d) Virtual Memory March 30, 2005 Announcements Lab 4 due next Monday (April

More information

Virtual to physical address translation

Virtual to physical address translation Virtual to physical address translation Virtual memory with paging Page table per process Page table entry includes present bit frame number modify bit flags for protection and sharing. Page tables can

More information

Main Memory: Address Translation

Main Memory: Address Translation Main Memory: Address Translation (Chapter 8) CS 4410 Operating Systems Can t We All Just Get Along? Physical Reality: different processes/threads share the same hardware à need to multiplex CPU (temporal)

More information

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

Virtual Memory 1. Virtual Memory

Virtual Memory 1. Virtual Memory Virtual Memory 1 Virtual Memory key concepts virtual memory, physical memory, address translation, MMU, TLB, relocation, paging, segmentation, executable file, swapping, page fault, locality, page replacement

More information

COSC 6385 Computer Architecture - Memory Hierarchies (I)

COSC 6385 Computer Architecture - Memory Hierarchies (I) COSC 6385 Computer Architecture - Memory Hierarchies (I) Edgar Gabriel Spring 2018 Some slides are based on a lecture by David Culler, University of California, Berkley http//www.eecs.berkeley.edu/~culler/courses/cs252-s05

More information

Background. Memory Hierarchies. Register File. Background. Forecast Memory (B5) Motivation for memory hierarchy Cache ECC Virtual memory.

Background. Memory Hierarchies. Register File. Background. Forecast Memory (B5) Motivation for memory hierarchy Cache ECC Virtual memory. Memory Hierarchies Forecast Memory (B5) Motivation for memory hierarchy Cache ECC Virtual memory Mem Element Background Size Speed Price Register small 1-5ns high?? SRAM medium 5-25ns $100-250 DRAM large

More information

CSE 560 Computer Systems Architecture

CSE 560 Computer Systems Architecture This Unit: CSE 560 Computer Systems Architecture App App App System software Mem I/O The operating system () A super-application Hardware support for an Page tables and address translation s and hierarchy

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #23: VM I 2006-08-08 CS 61C L23 VM I (1) Andy Carle Outline Cache Review Virtual Memory CS 61C L23 VM I (2) Improving Miss Penalty

More information

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

Chapter 8: Memory- Manage g me m nt n S tra r t a e t gie i s Chapter 8: Memory- Management Strategies Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The Intel Pentium 2009/12/16

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Spring 2018 L17 Main Memory Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 FAQ Was Great Dijkstra a magician?

More information

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

Memory Management. Frédéric Haziza Spring Department of Computer Systems Uppsala University Memory Management Frédéric Haziza Department of Computer Systems Uppsala University Spring 2008 Operating Systems Process Management Memory Management Storage Management Compilers Compiling

More information

Computer Organization and Architecture. OS Objectives and Functions Convenience Making the computer easier to use

Computer Organization and Architecture. OS Objectives and Functions Convenience Making the computer easier to use Computer Organization and Architecture Chapter 8 Operating System Support 1. Processes and Scheduling 2. Memory Management OS Objectives and Functions Convenience Making the computer easier to use Efficiency

More information

CS399 New Beginnings. Jonathan Walpole

CS399 New Beginnings. Jonathan Walpole CS399 New Beginnings Jonathan Walpole Memory Management Memory Management Memory a linear array of bytes - Holds O.S. and programs (processes) - Each cell (byte) is named by a unique memory address Recall,

More information

Virtual Memory 1. To do. q Segmentation q Paging q A hybrid system

Virtual Memory 1. To do. q Segmentation q Paging q A hybrid system Virtual Memory 1 To do q Segmentation q Paging q A hybrid system Address spaces and multiple processes IBM OS/360 Split memory in n parts (possible!= sizes) A process per partition Program Code Heap Operating

More information

Chapter 8 Main Memory

Chapter 8 Main Memory COP 4610: Introduction to Operating Systems (Spring 2014) Chapter 8 Main Memory Zhi Wang Florida State University Contents Background Swapping Contiguous memory allocation Paging Segmentation OS examples

More information

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit.

Memory Hierarchy. Goal: Fast, unlimited storage at a reasonable cost per bit. Memory Hierarchy Goal: Fast, unlimited storage at a reasonable cost per bit. Recall the von Neumann bottleneck - single, relatively slow path between the CPU and main memory. Fast: When you need something

More information