What is memory? CS10110: Memory Management. What is memory? What is memory? All computer systems have physical memory; used for storing:

Similar documents
Memory Management CS 217. Two programs can t control all of memory simultaneously

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging

IT 342 Operating Systems Fundamentals Fall 2014 Syllabus

tmpfs: A Virtual Memory File System

W4118 Operating Systems. Instructor: Junfeng Yang

How To Write A Page Table

CS5460: Operating Systems

Multi-core Programming System Overview

Virtual Machines. COMP 3361: Operating Systems I Winter

Virtual vs Physical Addresses

W4118: segmentation and paging. Instructor: Junfeng Yang

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction

Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing

Copyright by Parallels Holdings, Ltd. All rights reserved.

High-Performance Processing of Large Data Sets via Memory Mapping A Case Study in R and C++

Lecture 17: Virtual Memory II. Goals of virtual memory

WHITE PAPER Optimizing Virtual Platform Disk Performance

COS 318: Operating Systems. Virtual Memory and Address Translation

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

PrimeRail Installation Notes Version A June 9,

Chapter 6, The Operating System Machine Level

Enery Efficient Dynamic Memory Bank and NV Swap Device Management

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

REAL TIME OPERATING SYSTEM PROGRAMMING-II: II: Windows CE, OSEK and Real time Linux. Lesson-3: Windows and Memory Management

ELEC 377. Operating Systems. Week 1 Class 3

Lecture 25 Symbian OS

Hyper-V vs ESX at the datacenter

Understanding Virtual Memory In Red Hat Enterprise Linux 3

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

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

1 Storage Devices Summary

Networking Driver Performance and Measurement - e1000 A Case Study

Paging: Introduction A Simple Example And Overview

Using Synology SSD Technology to Enhance System Performance Synology Inc.

Outline: Operating Systems

Operating System Overview. Otto J. Anshus

Virtualization in Linux KVM + QEMU

Benchmarking Hadoop & HBase on Violin

Secondary Storage. Any modern computer system will incorporate (at least) two levels of storage: magnetic disk/optical devices/tape systems

Virtuoso and Database Scalability

Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System

Segmentation and Fragmentation

Priority Pro v17: Hardware and Supporting Systems

CS5460: Operating Systems. Lecture: Virtualization 2. Anton Burtsev March, 2013

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

& Data Processing 2. Exercise 3: Memory Management. Dipl.-Ing. Bogdan Marin. Universität Duisburg-Essen

Configuring Apache Derby for Performance and Durability Olav Sandstå

COS 318: Operating Systems

POSIX. RTOSes Part I. POSIX Versions. POSIX Versions (2)

Where is the memory going? Memory usage in the 2.6 kernel

Configuration Maximums VMware Infrastructure 3

Computer Engineering and Systems Group Electrical and Computer Engineering SCMFS: A File System for Storage Class Memory

CHAPTER 6 TASK MANAGEMENT

Uses for Virtual Machines. Virtual Machines. There are several uses for virtual machines:

Performance Monitor for AutoCAD

USB 2.0 Flash Drive User Manual

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 412, University of Maryland. Guest lecturer: David Hovemeyer.

AIX NFS Client Performance Improvements for Databases on NAS

On Benchmarking Popular File Systems

Tech Tip: Understanding Server Memory Counters

Chapter 7 Memory Management

Virtualization. Dr. Yingwu Zhu

Performance and scalability of a large OLTP workload

Virtual Switching Without a Hypervisor for a More Secure Cloud

Optimizing LTO Backup Performance

A Packet Forwarding Method for the ISCSI Virtualization Switch

Memory unit sees only the addresses, and not how they are generated (instruction counter, indexing, direct)

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

CHAPTER 2. Existing Server Environment Analysis with Capacity Planner

Operating Systems. 05. Threads. Paul Krzyzanowski. Rutgers University. Spring 2015

Muse Server Sizing. 18 June Document Version Muse

Parallels Virtuozzo Containers

Chapter 5 Cloud Resource Virtualization

The Benefits of Using VSwap

Outline. Outline. Why virtualization? Why not virtualize? Today s data center. Cloud computing. Virtual resource pool

Performance and Tuning Guide. SAP Sybase IQ 16.0

Chapter 8 Objectives. Chapter 8 Operating Systems and Utility Programs. Operating Systems. Operating Systems. Operating Systems.

Main Memory Data Warehouses

This Unit: Virtual Memory. CIS 501 Computer Architecture. Readings. A Computer System: Hardware

BEST PRACTICES FOR PARALLELS CONTAINERS FOR LINUX

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

Computer Architecture

PERFORMANCE ENHANCEMENTS IN TreeAge Pro 2014 R1.0

The Linux Virtual Filesystem

Best Practices on monitoring Solaris Global/Local Zones using IBM Tivoli Monitoring

Operating Systems, 6 th ed. Test Bank Chapter 7

Chapter 8: Installing Linux The Complete Guide To Linux System Administration Modified by M. L. Malone, 11/05

Proposal for Virtual Private Server Provisioning

OPERATING SYSTEM - MEMORY MANAGEMENT

Google File System. Web and scalability

Study and installation of a VOIP service on ipaq in Linux environment

Project Adding a System Call to the Linux Kernel

Operating Systems (Linux)

Xen and XenServer Storage Performance

Virtual Memory. Virtual Memory. Paging. CSE 380 Computer Operating Systems. Paging (1)

SALSA Flash-Optimized Software-Defined Storage

CS3600 SYSTEMS AND NETWORKS

lesson 1 An Overview of the Computer System

Transcription:

What is memory All computer systems have physical memory; used for storing: CS: Memory Management executable program code, stacks, user and kernel space data structures, etc. Michael Clarke mfc5@aber.ac.uk We need to (and do) access it in a random fashion; we call it RAM - Random Access Memory. When we write code, and run it, we use some of the memory: int a = 5; On a x86 system this will use 4 bytes! What is memory What is memory But, it is actually more complicated. We have memory mapped I/O devices. We have holes in the address space because of backwards compatibility in the x86 architecture with i86, etc.

What is memory Remember the fetch execute cycle... Fetch CPU Execute Remember the fetch execute cycle... Remember the fetch execute cycle... Fetch Fetch CPU CPU Execute Execute

Remember the fetch execute cycle... Remember the fetch execute cycle... Fetch Fetch CPU CPU Execute Error! What do we do with memory Memory Allocation We need to be able to allocate memory between processes. Processes may need more memory as they execute. What if programs need more memory than the system has What if two programs need to access the same memory For example, to write to the graphics card It s slow having to load in the same libraries such as libc for every running program! What does int i = 5; mean What does Object a = new Object(); mean There are various strategies for dynamic memory allocation: Memory pool (fixed size blocks allocation), Buddy blocks, Heap based, The slab allocator, and many more...

Memory Fragmentation Memory Fragmentation Memory Fragmentation Memory Fragmentation

Memory Fragmentation Memory Fragmentation Memory Fragmentation Virtual Memory It s fantastic... and a pain!! It lets processes use more memory than actually exists. It allows processes to be split up in memory; every process has the illusion that it is the only one using the memory! It provides methods for memory protection. We can implement Virtual Memory through Segmentation and Paging.

Virtual Memory: Segmentation Virtual Memory: Segmentation CPU Register: ds, cs,... xffffffff x xaf x x xffffffff Segment Segment Segment Segment : Offset Physical Address Space Segment 4. M A R G O R P A T A D S T A C K Global Descriptor Table Segment Kernel Read/Write, User None Kernel Write, User Read Only Kernel and User Read/Write Segment Segment Virtual Memory: Segmentation Virtual Memory: Segmentation CPU Register: ds, cs,... CPU Register: ds, cs,... Virtual Address Physical Address Space Virtual Address Physical Address Space x : x6 Segment 4 x : x6 Segment 4 Global Descriptor Table Segment Global Descriptor Table Segment 4 4 Segment Segment Segment Segment

Virtual Memory: Segmentation There are problems: We still have to load libraries in more than once. We still can t use more memory than physically exists. Page: 4KBs Programs will never have access to a full address space; some of the virtual address is used to identify the segment. We haven t really fixed the problems with memory holes. Page: 4KBs Page: 4KB H E L O W R D C U Kernel Read/Write, User None Kernel Write, User Read Only Kernel and User Read/Write x Virtual Memory: 4GB (496 MBs) xffffffff

Virtual Address x xffffffff Virtual Memory: 4GB (496 MBs) Page: 4KB H E L O W R D C U Page Directory 4... CPU Register: CR Page Directory 4... Page Table 4... Page Table 4... Physical Address Space 4K Page 4K Page 4K Page 4K Page x Virtual Memory: 4GB (496 MBs) xffffffff Virtual Address We can map any virtual address to any physical address, including memory mapped I/O addresses. We don t have to load libraries in more than once. H E L O W R D C U S M A B I G Y Programs can have a full address space.

H E L L O C S H E L O W R D C U S M A B I G Y H E L L O C S H E L O W R D C U S M A B I G Y Z ZZ H E L L O C S H E L L O C S H E L O W R D C U S M A B I G Y H E L O W R D C U S B I G Y M A Z ZZ Z ZZ

So, what is swapping H E L L O C S ZZ Z Z H E L O W R D C U S M A B I G Y Swapping is when we move a whole process to disk. Why would we ever want do this Paging and Swapping A large number of processes can run in a small amount of physical memory. Swapping is very slow, Paging is slow. Paging requires hardware support, swapping does not. It can lead to thrashing. If it happens a lot, consider buying more RAM. Some amount of paging is normal. Conclusions When we have more than one program running on a computer, we need a method of managing memory. The kernel does this, but also uses hardware features such as the MMU (Memory Management Unit) in the CPU (Central Processing Unit) Virtual Memory allows: for the isolation and protection of processes, more efficient use of memory, the ability to deal with memory holes, and processes to have full address spaces There are two types of VM: Segmentation and Paging. Paging and Swapping allows us to use more RAM than physically exists; but has drawbacks.

Further Reading Understanding the Linux Kernel. Daniel P. Bovet, Marco Cesati. O Reilly Media. ISBN: 978--596-565-8 Solaris Internals. Richard McDougall & Jim Mauro ISBN: --489- Intel 64 and IA- Architectures Software Developer s Manual. Available online at: http://www.intel.com/products/processor/manuals/ The Slab Allocator: An Object-Caching Kernel Memory Allocator. Jeff Bonwick, Sun Microsystems SunOS Virtual Memory Implementation. Joseph P. Moran, Sun Microsystems Virtual Memory Architecture in SunOS. Robert A. Gingell, Joseph P. Moran, William A. Shannon, Sun Microsystems