Sarah Diesburg Operating Systems CS 3430

Slides:



Advertisements
Similar presentations
Virtual Memory In this lecture, slides from lecture 16 from the course Computer Architecture ECE 201 by Professor Mike Schulte are used with permission.
Advertisements

Memory Management: Overlays and Virtual Memory
COMP381 by M. Hamdi 1 Virtual Memory. COMP381 by M. Hamdi 2 Virtual Memory: The Problem For example: MIPS64 is a 64-bit architecture allowing an address.
Virtual Memory main memory can act as a cache for secondary storage motivation: Allow programs to use more memory that there is available transparent to.
CSC 4250 Computer Architectures December 8, 2006 Chapter 5. Memory Hierarchy.
Day 20 Memory Management. Assumptions A process need not be stored as one contiguous block. The entire process must reside in main memory.
Homework 2 Review Cornell CS Calling Conventions int gcd(int x, int y) { int t, a = x, b = y; while(b != 0) { t = b; b = mod(a, b); a = t; } return.
Review CPSC 321 Andreas Klappenecker Announcements Tuesday, November 30, midterm exam.
Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
CS 140 Lecture Notes: Virtual MemorySlide 1 Load-Time Relocation Process 1 0 ∞ Process 3 Operating System Process 6.
Answers to the VM Problems Spring First question A computer has 32 bit addresses and a virtual memory with a page size of 8 kilobytes.  How many.
Direct Map Cache Tracing Exercise. Exercise #1: Setup Information CS2100 Cache I 2 Memory 4GB Memory Address 310N-1N Block Number Offset 1 Block = 8 bytes.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
CS 241 Section Week #12 (04/22/10).
1 Copyright © 2011, Elsevier Inc. All rights Reserved. Appendix B Authors: John Hennessy & David Patterson.
Week 7 February 17, 2004 Adrienne Noble. Important Dates Due Monday, Feb 23 Homework 7 Due Wednesday, Feb 25 Project 3 Due Friday, Feb 27 Homework 8.
Some VM Complications Extra memory accesses Page tables are huge
Problems in Memory Management CS 1550 Recitation October 9 th, 2002 The questions in this slide are from Andrew S. Tanenbaum's textbook page 264.
Lecture 19: Virtual Memory
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.
The Three C’s of Misses 7.5 Compulsory Misses The first time a memory location is accessed, it is always a miss Also known as cold-start misses Only way.
Address Translation. Recall from Last Time… Virtual addresses Physical addresses Translation table Data reads or writes (untranslated) Translation tables.
Chapter 91 Logical Address in Paging  Page size always chosen as a power of 2.  Example: if 16 bit addresses are used and page size = 1K, we need 10.
Introduction to Virtual Memory and Memory Management
1)A 13 bit address 8 bit parallelism processor has a 1KB EPROM at address 4K and it is sure that no address in the 5K-6K is used. What is the simplest.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
ICOM Noack Memory management Virtual memory Paging and segmentation Demand paging Memory management hardware.
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
Address Translation Andy Wang Operating Systems COP 4610 / CGS 5765.
Address Translation Mark Stanovich Operating Systems COP 4610.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
Memory Management Continued Questions answered in this lecture: What is paging? How can segmentation and paging be combined? How can one speed up address.
Memory Hierarchy and Cache Design (4). Reducing Hit Time 1. Small and Simple Caches 2. Avoiding Address Translation During Indexing of the Cache –Using.
CS 140 Lecture Notes: Virtual MemorySlide 1 Load-Time Relocation Process 1 0 ∞ Process 3 Operating System Process 6.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
3/1/2002CSE Virtual Memory Virtual Memory CPU On-chip cache Off-chip cache DRAM memory Disk memory Note: Some of the material in this lecture are.
Memory: Page Table Structure
CS 140 Lecture Notes: Virtual Memory
Lecture 11 Virtual Memory
Improving Memory Access The Cache and Virtual Memory
Virtual Memory User memory model so far:
Sarah Diesburg Operating Systems CS 3430
Copyright © 2011, Elsevier Inc. All rights Reserved.
Memory Hierarchy Virtual Memory, Address Translation
CS510 Operating System Foundations
CS 140 Lecture Notes: Virtual Memory
Sarah Diesburg Operating Systems CS 3430
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Paging Lecture November 2018.
Andy Wang Operating Systems COP 4610 / CGS 5765
FIGURE 12-1 Memory Hierarchy
CS241 Section: Week 10.
Sarah Diesburg Operating Systems CS 3430
Lecture 22: Cache Hierarchies, Memory
Virtual Memory فصل هشتم.
CS 140 Lecture Notes: Virtual Memory
Andy Wang Operating Systems COP 4610 / CGS 5765
Sarah Diesburg Operating Systems CS 3430
Overheads for Computers as Components 2nd ed.
Virtual Memory.
Introduction to the Pentium’s support for “virtual” memory
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
Andy Wang Operating Systems COP 4610 / CGS 5765
CS 140 Lecture Notes: Virtual Memory
Sarah Diesburg Operating Systems CS 3430
Andy Wang Operating Systems COP 4610 / CGS 5765
Sarah Diesburg Operating Systems COP 4610
Memory Management & Virtual Memory
Presentation transcript:

Sarah Diesburg Operating Systems CS 3430 Suggested Exercise #7 Sarah Diesburg Operating Systems CS 3430

Problem 1 (a) 32-bit addressing Page size: 4 Kbytes (212 bytes) Pure paging 232 bytes / 212 bytes/entry= 220 entries Each page table entry 20-bit physical page number 4 status bits Page table size = 220 entries * 3 bytes/entry = 3 Mbytes

Paging Diagram 32 – 12 = 20 bits for 32-bit machines log2(4KB) = 12 bits for 4-KB pages Virtual page number Offset Page table size > Error 4 status bits 220 entries Physical page number Physical page number Offset

Problem 1 (b) Segmented-paging address translation Page size: 4 Kbytes (212 bytes) Offset: 12 bits Three segments: code, data, stack Virtual segment number: log23 = 2 bits Virtual page number 32 – 12 – 2 = 18 bits

Segmented Paging 32 bits for 4-GB 32 - 2 - 12 = 18 bits Page table base Page table bound 22 entries 12 bits for 4-KB pages 20 bits num of entries defined by bound; up to 218 Seg # Offset Virt page # Phy page # log2(3 segments) = 2 bits

Segmented Paging 32 – 2 – 12 = 18 bits 218 Seg # Offset Virt page # Page table size > Error Page table base + Phy page # Phy page # Offset log2(4GB) = 32 bits

Problem 1 (b) Each segment (code, data, stack) uses 16 Kbytes = 4 pages 3 page tables: Code-segment page table: 4 entries Page table entry 20 bits to address all physical page numbers 4 status bits 24 bits/entry * 4 entries = 96 bits Same for data-segment page table and stack-segment page table Total: 96 bits * 3 = 288 bits

Problem 1 (b) Each segment (code, data, stack) uses 16 Kbytes = 4 pages 1 segment table: 4 entries 32 bits for the page table base 18 bits for the page table number bound 4 status bits Total memory: 4 * (32 + 18 + 4) = 216 bits

Problem 2 Effective access time Cache hit rate L1 cache 1 clock cycle 98% L2 cache 2 clock cycles 99% Memory 6 clock cycles 100% Effective access time = P(hit)*cost(hit) + P(miss)*cost(miss) = P(L1 hit)*cost(L1 hit) + P(L1 miss)*cost(L1 miss) = 98%*(1 clock cycle) + 2%*cost(L1_miss)

Problem 2 What is cost(L1_miss)? cost(L1_miss) = P(L2_hit)*cost(L1_miss+L2_hit) + P(L2_miss)*cost(L1_miss+L2_miss+mem_hit) Access time Cache hit rate L1 cache 1 clock cycle 98% L2 cache 2 clock cycles 99% Memory 6 clock cycles 100%

Problem 2 Access time Cache hit rate L1 cache 1 clock cycle 98% 2 clock cycles 99% Memory 6 clock cycles 100% L1 98% 1 cycle 1% 1 cycle hit L2 99% 2 cycles 1% 2 cycles hit memory 100% 6 cycles hit

Problem 2 Effective access time = 98%*1 + 2%*99%(1 + 2) + 2%*1%(1 + 2 + 6) L1 98% 1 cycle 2% 1 cycle hit L2 99% 2 cycles 1% 2 cycles hit memory 100% 6 cycles hit