Memory Allocation in VxWorks 6.0 White Paper

Size: px
Start display at page:

Download "Memory Allocation in VxWorks 6.0 White Paper"

Transcription

1 Memory Allocation in VxWorks 6.0 White Paper Zoltan Laszlo Wind River Systems, Inc. Copyright 2005 Wind River Systems, Inc

2 1 Introduction Memory allocation is a typical software engineering problem for which there are numerous solutions, but each requires compromises. The evaluation criteria of a memory allocator usually include execution speed, memory overhead, and vulnerability to internal and external fragmentation [Ran69, WJN95]. What makes evaluation difficult is that allocation patterns differ significantly from application to application, system to system. A given allocator could perform well under certain allocation pattern, but perform poorly under a different pattern. For this reason, it is difficult to implement a one-size-fits-all, general purpose memory allocator. In this paper, two different implementations of the memory allocation library of VxWorks are evaluated and compared. In earlier version of VxWorks, a simple memory allocation library was used. The implementation was based on the first fit allocation policy, with free memory blocks stored in a linked list. At the time, this library was satisfactory due to the hard real-time nature of the typical applications run on VxWorks. The expectation was that resources are created and allocated mostly during system initialization, and rarely freed or destroyed. Over time, as the complexity of the applications grew, and standards such as C++, Java, and POSIX became more widely used in device software development, the performance of dynamic memory management became more important. In VxWorks 6.0, a new implementation of the memory allocation library was introduced. This new implementation is based on the best-fit allocation policy, resulting in less susceptibility to fragmentation and more deterministic execution time. 2 First-fit allocation With first-fit allocation policy, there is no attempt made to order the free blocks in any way. Free blocks can be stored in a simple linked list, and the search algorithm is simply to walk the list until a free memory block large enough to satisfy the request is found. When freeing memory, unless the block can be coalesced to one of the adjacent blocks, the block being freed is inserted at the head of the linked list. Figure 1 shows the linear memory representation of the free blocks linked in a simple list. Root Free Alloc Alloc Free Alloc Free Alloc Alloc Alloc Free The first-fit allocation policy results in relatively small memory overhead and simple block search algorithm. In the best-case scenario, the first block on the free list can satisfy the request; this results in very fast allocation. However, if dynamic allocation and freeing are performed, the memory managed inevitably becomes fragmented over time. With first-fit policy, larger blocks are more likely to be split in two, with the remainder of the block becoming a smaller free block on the list. To make things worse, the small fragments created after splitting larger blocks are less likely to get used up, because they are too small for the new blocks being allocated; therefore, they will end up queued in the front of the list. Searching for larger blocks requires walking over these small blocks, resulting in significantly reduced worst-case and average allocation performance. Figure 1. Linked list of free blocks 1 MEMORY ALLOCATION IN VXWORKS 6.0 Copyright 2005 Wind River Systems, Inc.

3 3 Best-fit allocation With best-fit allocation policy, the set of free blocks has to be searched for the smallest-sized block that is big enough to satisfy the request. In order to make such search acceptable, a more complex data structure to store the free blocks has to be used (e.g., binary tree). Maintaining this data requires increased overhead and more complex algorithms, compared to the first-fit policy. Figure 2 shows the linear memory and logical representation of a heap with five free blocks of sizes 200, 2x100, and 2x300 bytes. Root F1 200 F2 F3 Alloc Alloc Alloc Alloc F4 100 Alloc F5 300 Root 200 F1 100 F2 F4 300 F5 F3 Whenever a new size is created, a new node is inserted in the tree. When blocks of a certain size are all used up, the corresponding node is removed from the tree. After such changes, the tree is rebalanced in order to maintain ideal search time. Figure 2. Tree of lists structure of free blocks The advantage of the best-fit allocation policy is that the probability of a larger block having to be split is smaller. Second, free blocks of the same size can be grouped together; this reduces the number of nodes that need to be searched. Finally, with the ordered data structures, a significantly more efficient searching algorithm can be used. For a balanced binary tree, for example, the search has O(log(n)) complexity, compared with the linear search¾with O(n) complexity¾used in the first-fit implementation. All these result in significantly better worst-case performance. In other words, the result is a more deterministic allocation time. 2 MEMORY ALLOCATION IN VXWORKS 6.0 Copyright 2005 Wind River Systems, Inc.

4 4 Performance evaluation In this section, the two implementations are compared based on allocation time, fragmentation, and code size. Note that these benchmark results should be considered without a time unit in mind. The goal is only to provide a qualitative comparison of two algorithms under similar conditions (i.e., identical target platform and identical configuration), and not a quantitative benchmark result. Therefore, the time units are omitted from the graphs. In these benchmarks, each allocation is for a weighted random number of bytes, with smaller blocks (tens of bytes) being allocated with higher probability than larger blocks (hundreds of bytes). Such an allocation pattern has been shown to be closer to real-world allocation patterns of various applications [WJN95]. Figure 3 shows the distribution of the number of allocated blocks as a function of block size. Figure 3. Distribution of block sizes 4.1 Allocation time and fragmentation with identical allocation pattern This section presents benchmark results for the best-fit and first-fit memory allocators running an identical memory allocation pattern, as explained above. Figure 4 shows the number of free blocks and the average allocation time as a function of the number of elapsed cycles. Each cycle represents a fixed number of allocation and free operations. The graphs show near constant allocation time and a very small number of free blocks for the best-fit algorithm. Under the same conditions, the first-fit algorithm incurs significant fragmentation (a large number of free blocks) and increasing average allocation time. However, early on, while fragmentation is still low, the first-fit algorithm results in better allocation time. This difference results from the cost of maintaining the balanced tree that stores the free blocks. 3 MEMORY ALLOCATION IN VXWORKS 6.0 Copyright 2005 Wind River Systems, Inc.

5 Figure 4. Allocation time and fragmentation 4.2 Allocation time as a function of fragmentation level This section shows benchmark results for allocation and free operations under similar fragmentation levels (a higher number of free blocks means increased fragmentation). Each measurement in Figure 5 represents an average of 100 allocations of different sizes. The size distribution of the allocations is similar to the one shown in Figure 3. 4 MEMORY ALLOCATION IN VXWORKS 6.0 Copyright 2005 Wind River Systems, Inc.

6 As the results show, the best-fit algorithm performs more deterministically, with near constant allocation and free time under the measured range (in reality, the result is logarithmic, but the increase in time is becoming more significant under much higher fragmentation levels only). At the same time, the allocation time for the first-fit algorithm increases linearly with the fragmentation. Freeing is near constant for the first-fit allocator as well. The slightly faster freeing time of the first-fit algorithm results from its simple method of inserting free blocks at the head of the free list. Figure 5. Allocation time 4.3 Library size In this section, the size of the allocator libraries, mempartlib and memlib, are compared. The two libraries together implement the full set of memory partition and heap management routines. Table 1 shows library sizes (in bytes) for the best-fit and first-fit implementations. However, note that the increase for best-fit implementation is not entirely due to the new allocation policy; it also provides additional reliability and error detection enhancements not available in the first-fit implementation. For more details about the API provided by these libraries, see the VxWorks API Reference Guide. The best-fit implementation also uses a shared utility for managing binary trees. Since this utility is also used by other VxWorks kernel libraries, its size is not counted here. 5 MEMORY ALLOCATION IN VXWORKS 6.0 Copyright 2005 Wind River Systems, Inc.

7 First-Fit Best-Fit text data bss text data bss Table 1. Code size of firstfit and best-fit allocators mempartlib memlib TOTAL Summary Dynamic memory allocation is becoming an increasingly important performance criterion in device software development. Increased reliance on allocations means memory is more likely to become fragmented over time, reducing the ability of systems to function reliably over extended period of time. The best-fit allocation policy employed in VxWorks 6.0 s memory partition library provides reduced vulnerability to fragmentation and has a more deterministic allocation time. Improved overall performance, however, comes at the cost of increased complexity and code size, due to the more complicated method of storing the free block information. Also, allocation time at very low fragmentation levels with the best-fit algorithm can be slower compared to the first-fit algorithm. 6 References [WJN95] [Ran69] Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles. Dynamic Storage Allocation: A Survey and Critical Review in International Workshop on Memory Management. Kinross: Scotland, UK. September Brian Randell. A note on storage fragmentation and program segmentation. Communications of the ACM, 12(7): July MEMORY ALLOCATION IN VXWORKS 6.0 Copyright 2005 Wind River Systems, Inc.

11.1 Segmentation: Generalized Base/Bounds

11.1 Segmentation: Generalized Base/Bounds 11 Segmentation So far we have been putting the entire address space of each process in memory. With the base and bounds registers, the OS can easily relocate processes to different parts of physical memory.

More information

DYNAMIC MEMORY ALLOCATOR ALGORITHMS SIMULATION AND PERFORMANCE ANALYSIS

DYNAMIC MEMORY ALLOCATOR ALGORITHMS SIMULATION AND PERFORMANCE ANALYSIS ISTANBUL UNIVERSITY JOURNAL OF ELECTRICAL & ELECTRONICS ENGINEERING YEAR VOLUME NUMBER : 25 : 5 : 2 (1435-1441) DYNAMIC MEMORY ALLOCATOR ALGORITHMS SIMULATION AND PERFORMANCE ANALYSIS 1 Fethullah Karabiber

More information

Dynamic Memory Allocation. Gerson Robboy Portland State University. class20.ppt

Dynamic Memory Allocation. Gerson Robboy Portland State University. class20.ppt Dynamic Memory Allocation Gerson Robboy Portland State University class20.ppt Harsh Reality Memory is not unbounded It must be allocated and managed Many applications are memory dominated Especially those

More information

DYNAMIC MEMORY MANAGEMENT FOR EMBEDDED REAL-TIME SYSTEMS

DYNAMIC MEMORY MANAGEMENT FOR EMBEDDED REAL-TIME SYSTEMS DYNAMIC MEMORY MANAGEMENT FOR EMBEDDED REAL-TIME SYSTEMS A. Crespo, I. Ripoll, M. Masmano Universidad Polit«ecnica de Valencia 46022 Valencia, Spain {acrespo,iripoll,mmasmano}@disca.upv.es Abstract Keywords:

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation CS61, Lecture 10 Prof. Stephen Chong October 4, 2011 Announcements 1/2 Assignment 4: Malloc Will be released today May work in groups of one or two Please go to website and enter

More information

Dynamic Memory Allocation

Dynamic Memory Allocation 1 Dynamic Memory Allocation Anne Bracy CS 3410 Computer Science Cornell University Note: these slides derive from those by Markus Püschel at CMU 2 Recommended Approach while (TRUE) { code a little; test

More information

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia Memory Allocation II CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun

More information

Events, Memory Management

Events, Memory Management Events, Memory Management Events, Memory Management 1. Call back, message pumps 2. Call backs vs messages 3. Memory management Callback Program registers and event handler program that is called whenever

More information

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

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 Heap Management The heap is the portion of the store that is used for data that lives indefinitely, or until the program explicitly deletes it. While local variables typically become inaccessible when

More information

Memory Allocation with Lazy Fits

Memory Allocation with Lazy Fits Memory Allocation with Lazy Fits Yoo C. Chung Soo-Mook Moon School of Electrical Engineering Seoul National University Kwanak PO Box 34, Seoul 151-742, Korea {chungyc,smoon}@altair.snu.ac.kr ABSTRACT Dynamic

More information

Requirements, Partitioning, paging, and segmentation

Requirements, Partitioning, paging, and segmentation Requirements, Partitioning, paging, and segmentation Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated efficiently to pack as many processes into memory

More information

Requirements, Partitioning, paging, and segmentation

Requirements, Partitioning, paging, and segmentation Requirements, Partitioning, paging, and segmentation Main Memory: The Big Picture kernel memory proc struct kernel stack/u area Stack kernel stack/u area Stack kernel stack/u area Stack Data Text (shared)

More information

Virtual Memory. Chapter 8

Virtual Memory. Chapter 8 Chapter 8 Virtual Memory What are common with paging and segmentation are that all memory addresses within a process are logical ones that can be dynamically translated into physical addresses at run time.

More information

Balanced Search Trees

Balanced Search Trees Balanced Search Trees Computer Science E-22 Harvard Extension School David G. Sullivan, Ph.D. Review: Balanced Trees A tree is balanced if, for each node, the node s subtrees have the same height or have

More information

DYNAMIC MEMORY MANAGEMENT FOR EMBEDDED REAL-TIME SYSTEMS

DYNAMIC MEMORY MANAGEMENT FOR EMBEDDED REAL-TIME SYSTEMS DYNAMIC MEMORY MANAGEMENT FOR EMBEDDED REAL-TIME SYSTEMS A. Crespo, I. RipoU, M. Masmano Universidad Politecnica de Valencia 46022 Valencia, Spain {acrespo,iripoll,mmasmano]-@disca.upv.es Abstract Keywords:

More information

Memory management. Johan Montelius KTH

Memory management. Johan Montelius KTH Memory management Johan Montelius KTH 2017 1 / 22 C program # include int global = 42; int main ( int argc, char * argv []) { if( argc < 2) return -1; int n = atoi ( argv [1]); int on_stack

More information

Programming Assignment 3

Programming Assignment 3 UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Spring 2016 Programming Assignment 3 Introduction For this programming assignment you are to write a C, C++, Java, or Python

More information

Dynamic Memory Allocation I Nov 5, 2002

Dynamic Memory Allocation I Nov 5, 2002 15-213 The course that gives CMU its Zip! Dynamic Memory Allocation I Nov 5, 2002 Topics Simple explicit allocators Data structures Mechanisms Policies class21.ppt Harsh Reality Memory is not unbounded

More information

Run-time Environments -Part 3

Run-time Environments -Part 3 Run-time Environments -Part 3 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Compiler Design Outline of the Lecture Part 3 What is run-time support?

More information

Dynamic Memory Allocation I

Dynamic Memory Allocation I Dynamic Memory Allocation I William J. Taffe Plymouth State University Using the Slides of Randall E. Bryant Carnegie Mellon University Topics Simple explicit allocators Data structures Mechanisms Policies

More information

In multiprogramming systems, processes share a common store. Processes need space for:

In multiprogramming systems, processes share a common store. Processes need space for: Memory Management In multiprogramming systems, processes share a common store. Processes need space for: code (instructions) static data (compiler initialized variables, strings, etc.) global data (global

More information

An Efficient Heap Management Technique with Minimum Fragmentation and Auto Compaction

An Efficient Heap Management Technique with Minimum Fragmentation and Auto Compaction An Efficient Heap Management Technique with Minimum Fragmentation and Auto Compaction Krishna Lal. Baishnab, Soumyabrata Dev, Ziaul Haque Choudhury, Amlan Nag klbaishnab@gmail.com, dev.soumyabrata@gmail.com,

More information

Main Memory and the CPU Cache

Main Memory and the CPU Cache Main Memory and the CPU Cache CPU cache Unrolled linked lists B Trees Our model of main memory and the cost of CPU operations has been intentionally simplistic The major focus has been on determining

More information

Robust Memory Management Schemes

Robust Memory Management Schemes Robust Memory Management Schemes Prepared by : Fadi Sbahi & Ali Bsoul Supervised By: Dr. Lo ai Tawalbeh Jordan University of Science and Technology Robust Memory Management Schemes Introduction. Memory

More information

Process Layout, Function Calls, and the Heap

Process Layout, Function Calls, and the Heap Process Layout, Function Calls, and the Heap CS 6 Spring 20 Prof. Vern Paxson TAs: Devdatta Akhawe, Mobin Javed, Matthias Vallentin January 9, 20 / 5 2 / 5 Outline Process Layout Function Calls The Heap

More information

Preview. Memory Management

Preview. Memory Management Preview Memory Management With Mono-Process With Multi-Processes Multi-process with Fixed Partitions Modeling Multiprogramming Swapping Memory Management with Bitmaps Memory Management with Free-List Virtual

More information

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

Operating systems. Part 1. Module 11 Main memory introduction. Tami Sorgente 1 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

More information

Engine Support System. asyrani.com

Engine Support System. asyrani.com Engine Support System asyrani.com A game engine is a complex piece of software consisting of many interacting subsystems. When the engine first starts up, each subsystem must be configured and initialized

More information

Dynamic Memory Allocation. Basic Concepts. Computer Organization 4/3/2012. CSC252 - Spring The malloc Package. Kai Shen

Dynamic Memory Allocation. Basic Concepts. Computer Organization 4/3/2012. CSC252 - Spring The malloc Package. Kai Shen Dynamic Memory Allocation: Basic Concepts Kai Shen Dynamic Memory Allocation Programmers use dynamic memory allocators (such as malloc) to acquire memory at run time. For data structures whose size is

More information

Virtual Memory. 11/8/16 (election day) Vote!

Virtual Memory. 11/8/16 (election day) Vote! Virtual Memory 11/8/16 (election day) Vote! Recall: the job of the OS The OS is an interface layer between a user s programs and hardware. Program Operating System Computer Hardware It provides an abstract

More information

Run-time Environments - 3

Run-time Environments - 3 Run-time Environments - 3 Y.N. Srikant Computer Science and Automation Indian Institute of Science Bangalore 560 012 NPTEL Course on Principles of Compiler Design Outline of the Lecture n What is run-time

More information

Memory Management Basics

Memory Management Basics Memory Management Basics 1 Basic Memory Management Concepts Address spaces! Physical address space The address space supported by the hardware Ø Starting at address 0, going to address MAX sys! MAX sys!!

More information

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018

CS 31: Intro to Systems Virtual Memory. Kevin Webb Swarthmore College November 15, 2018 CS 31: Intro to Systems Virtual Memory Kevin Webb Swarthmore College November 15, 2018 Reading Quiz Memory Abstraction goal: make every process think it has the same memory layout. MUCH simpler for compiler

More information

Review! Lecture 5 C Memory Management !

Review! Lecture 5 C Memory Management ! CS61C L05 C Memory Management (1)! inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 5 C Memory Management 2010-06-28!!! Instructor Paul Pearce! Symmetric multiprocessor! MIPS support for

More information

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to:

General Objective:To understand the basic memory management of operating system. Specific Objectives: At the end of the unit you should be able to: F2007/Unit6/1 UNIT 6 OBJECTIVES General Objective:To understand the basic memory management of operating system Specific Objectives: At the end of the unit you should be able to: define the memory management

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 5 C Memory Management 2010-06-28!!! Instructor Paul Pearce! Symmetric multiprocessor! MIPS support for Android MIPS Technologies (founded

More information

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Memory Management. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory Management q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory management Ideal memory for a programmer large, fast, nonvolatile and cheap not an option

More information

Background. Contiguous Memory Allocation

Background. Contiguous Memory Allocation Operating System Lecture 8 2017.5.9 Chapter 8 (Main Memory) Background Swapping Contiguous Memory Allocation Segmentation - Paging Memory Management Selection of a memory-management method for a specific

More information

CS61C : Machine Structures

CS61C : Machine Structures inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #6: Memory Management CS 61C L06 Memory Management (1) 2006-07-05 Andy Carle Memory Management (1/2) Variable declaration allocates

More information

ECE 598 Advanced Operating Systems Lecture 10

ECE 598 Advanced Operating Systems Lecture 10 ECE 598 Advanced Operating Systems Lecture 10 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 17 February 2015 Announcements Homework #1 and #2 grades, HW#3 Coming soon 1 Various

More information

Dynamic Memory Management

Dynamic Memory Management Dynamic Memory Management Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Lecture Dynamic memory management o Garbage collection by the run-time system (Java) o Manual deallocation

More information

Part II: Memory Management. Chapter 7: Physical Memory Chapter 8: Virtual Memory Chapter 9: Sharing Data and Code in Main Memory

Part II: Memory Management. Chapter 7: Physical Memory Chapter 8: Virtual Memory Chapter 9: Sharing Data and Code in Main Memory Part II: Memory Management Chapter 7: Physical Memory Chapter 8: Virtual Memory Chapter 9: Sharing Data and Code in Main Memory 1 7. Physical Memory 7.1 Preparing a Program for Execution Program Transformations

More information

Algorithms in Systems Engineering ISE 172. Lecture 16. Dr. Ted Ralphs

Algorithms in Systems Engineering ISE 172. Lecture 16. Dr. Ted Ralphs Algorithms in Systems Engineering ISE 172 Lecture 16 Dr. Ted Ralphs ISE 172 Lecture 16 1 References for Today s Lecture Required reading Sections 6.5-6.7 References CLRS Chapter 22 R. Sedgewick, Algorithms

More information

CS420: Operating Systems

CS420: Operating Systems Main Memory James Moscola Department of Engineering & Computer Science York College of Pennsylvania Based on Operating System Concepts, 9th Edition by Silberschatz, Galvin, Gagne Background Program must

More information

Application Note: Heap Memory Management

Application Note: Heap Memory Management Application Note: Heap Memory Management Document Number: SWRA204 Texas Instruments, Inc. San Diego, California USA Copyright 2006-2009 Texas Instruments, Inc. All rights reserved. Version Description

More information

CSE100. Advanced Data Structures. Lecture 8. (Based on Paul Kube course materials)

CSE100. Advanced Data Structures. Lecture 8. (Based on Paul Kube course materials) CSE100 Advanced Data Structures Lecture 8 (Based on Paul Kube course materials) CSE 100 Treaps Find, insert, delete, split, and join in treaps Randomized search trees Randomized search tree time costs

More information

Process s Address Space. Dynamic Memory. Backing the Heap. Dynamic memory allocation 3/29/2013. When a process starts the heap is empty

Process s Address Space. Dynamic Memory. Backing the Heap. Dynamic memory allocation 3/29/2013. When a process starts the heap is empty /9/01 Process s Address Space Dynamic Memory 0x7fffffff Stack Data (Heap) Data (Heap) 0 Text (Code) Backing the Heap When a process starts the heap is empty The process is responsible for requesting memory

More information

Optimizing Dynamic Memory Management

Optimizing Dynamic Memory Management Optimizing Dynamic Memory Management 1 Goals of this Lecture Help you learn about: Details of K&R heap mgr Heap mgr optimizations related to Assignment #5 Faster free() via doubly-linked list, redundant

More information

August 1994 / Features / Cache Advantage. Cache design and implementation can make or break the performance of your high-powered computer system.

August 1994 / Features / Cache Advantage. Cache design and implementation can make or break the performance of your high-powered computer system. Cache Advantage August 1994 / Features / Cache Advantage Cache design and implementation can make or break the performance of your high-powered computer system. David F. Bacon Modern CPUs have one overriding

More information

CS 390 Chapter 8 Homework Solutions

CS 390 Chapter 8 Homework Solutions CS 390 Chapter 8 Homework Solutions 8.3 Why are page sizes always... Page sizes that are a power of two make it computationally fast for the kernel to determine the page number and offset of a logical

More information

DDS Dynamic Search Trees

DDS Dynamic Search Trees DDS Dynamic Search Trees 1 Data structures l A data structure models some abstract object. It implements a number of operations on this object, which usually can be classified into l creation and deletion

More information

Chapter 12: Indexing and Hashing. Basic Concepts

Chapter 12: Indexing and Hashing. Basic Concepts Chapter 12: Indexing and Hashing! Basic Concepts! Ordered Indices! B+-Tree Index Files! B-Tree Index Files! Static Hashing! Dynamic Hashing! Comparison of Ordered Indexing and Hashing! Index Definition

More information

C SCI 335 Software Analysis & Design III Lecture Notes Prof. Stewart Weiss Chapter 4: B Trees

C SCI 335 Software Analysis & Design III Lecture Notes Prof. Stewart Weiss Chapter 4: B Trees B-Trees AVL trees and other binary search trees are suitable for organizing data that is entirely contained within computer memory. When the amount of data is too large to fit entirely in memory, i.e.,

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru Department of Electronics and Communication Engineering

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru Department of Electronics and Communication Engineering PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -560100 Department of Electronics and Communication Engineering Faculty: Richa Sharma Subject: Operating System SCHEME & SOLUTION

More information

The Memory Management Unit. Operating Systems. Autumn CS4023

The Memory Management Unit. Operating Systems. Autumn CS4023 Operating Systems Autumn 2017-2018 Outline The Memory Management Unit 1 The Memory Management Unit Logical vs. Physical Address Space The concept of a logical address space that is bound to a separate

More information

Java Memory Allocation with Lazy Worst Fit for Small Objects

Java Memory Allocation with Lazy Worst Fit for Small Objects The Computer Journal Advance Access published May 13, 2005 The Author 2005. Published by Oxford University Press on behalf of The British Computer Society. All rights reserved. For Permissions, please

More information

Chapter 12: Indexing and Hashing

Chapter 12: Indexing and Hashing Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B+-Tree Index Files B-Tree Index Files Static Hashing Dynamic Hashing Comparison of Ordered Indexing and Hashing Index Definition in SQL

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 26: Dynamic Memory (2) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

Dynamic Memory Management! Goals of this Lecture!

Dynamic Memory Management! Goals of this Lecture! Dynamic Memory Management!!! 1 Goals of this Lecture! Help you learn about:! Dynamic memory management techniques! Garbage collection by the run-time system (Java)! Manual deallocation by the programmer

More information

Section 5.3: Event List Management

Section 5.3: Event List Management Section 53: Event List Management Discrete-Event Simulation: A First Course c 2006 Pearson Ed, Inc 0-3-4297-5 Discrete-Event Simulation: A First Course Section 53: Event List Management / 3 Section 53:

More information

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

Chapter 8: Memory- Management Strategies. Operating System Concepts 9 th Edition Chapter 8: Memory- Management Strategies Operating System Concepts 9 th Edition Silberschatz, Galvin and Gagne 2013 Chapter 8: Memory Management Strategies Background Swapping Contiguous Memory Allocation

More information

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems. Memory Management. Lecture 9 Michael O Boyle Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation Goals

More information

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

CIS Operating Systems Contiguous Memory Allocation. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems Contiguous Memory Allocation Professor Qiang Zeng Spring 2018 Previous class Uniprocessor policies FCFS, Shortest Job First Round Robin Multilevel Feedback Queue Multiprocessor

More information

Flash Drive Emulation

Flash Drive Emulation Flash Drive Emulation Eric Aderhold & Blayne Field aderhold@cs.wisc.edu & bfield@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison Abstract Flash drives are becoming increasingly

More information

Multiprocessor Systems. Chapter 8, 8.1

Multiprocessor Systems. Chapter 8, 8.1 Multiprocessor Systems Chapter 8, 8.1 1 Learning Outcomes An understanding of the structure and limits of multiprocessor hardware. An appreciation of approaches to operating system support for multiprocessor

More information

Today. Dynamic Memory Allocation: Basic Concepts. Dynamic Memory Allocation. Dynamic Memory Allocation. malloc Example. The malloc Package

Today. Dynamic Memory Allocation: Basic Concepts. Dynamic Memory Allocation. Dynamic Memory Allocation. malloc Example. The malloc Package Today Dynamic Memory Allocation: Basic Concepts Basic concepts Performance concerns Approach 1: implicit free lists CSci 01: Machine Architecture and Organization October 17th-nd, 018 Your instructor:

More information

A Non-Fragmenting Non-Moving, Garbage Collector

A Non-Fragmenting Non-Moving, Garbage Collector A Non-ragmenting Non-Moving, Garbage Collector Gustavo Rodriguez-Rivera 1. ABSTRACT One of the biggest disadvantages of nonmoving collectors compared to moving collectors has been their limited ability

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

Lecture 5. Treaps Find, insert, delete, split, and join in treaps Randomized search trees Randomized search tree time costs

Lecture 5. Treaps Find, insert, delete, split, and join in treaps Randomized search trees Randomized search tree time costs Lecture 5 Treaps Find, insert, delete, split, and join in treaps Randomized search trees Randomized search tree time costs Reading: Randomized Search Trees by Aragon & Seidel, Algorithmica 1996, http://sims.berkeley.edu/~aragon/pubs/rst96.pdf;

More information

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program!

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program! Memory Management in a Uniprogrammed System! A! gets a fixed segment of (usually highest )"! One process executes at a time in a single segment"! Process is always loaded at "! Compiler and linker generate

More information

CIS Operating Systems Non-contiguous Memory Allocation. Professor Qiang Zeng Spring 2018

CIS Operating Systems Non-contiguous Memory Allocation. Professor Qiang Zeng Spring 2018 CIS 3207 - Operating Systems Non-contiguous Memory Allocation Professor Qiang Zeng Spring 2018 Big picture Fixed partitions Dynamic partitions Buddy system Contiguous allocation: Each process occupies

More information

Comparing Implementations of Optimal Binary Search Trees

Comparing Implementations of Optimal Binary Search Trees Introduction Comparing Implementations of Optimal Binary Search Trees Corianna Jacoby and Alex King Tufts University May 2017 In this paper we sought to put together a practical comparison of the optimality

More information

Lecture Notes on Garbage Collection

Lecture Notes on Garbage Collection Lecture Notes on Garbage Collection 15-411: Compiler Design Frank Pfenning Lecture 21 November 4, 2014 These brief notes only contain a short overview, a few pointers to the literature with detailed descriptions,

More information

Operating Systems (2INC0) 2017/18

Operating Systems (2INC0) 2017/18 Operating Systems (2INC0) 2017/18 Memory Management (09) Dr. Courtesy of Dr. I. Radovanovic, Dr. R. Mak (figures from Bic & Shaw) System Architecture and Networking Group Agenda Reminder: OS & resources

More information

Main Memory (Part I)

Main Memory (Part I) Main Memory (Part I) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/5 1 / 47 Motivation and Background Amir

More information

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia Memory Allocation II CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/1909/

More information

Dynamic Memory Allocation II October 22, 2008

Dynamic Memory Allocation II October 22, 2008 15-213 Dynamic Memory Allocation II October 22, 2008 Topics Explicit doubly-linked free lists Segregated free lists Garbage collection Review of pointers Memory-related perils and pitfalls class18.ppt

More information

Dynamic Memory Management

Dynamic Memory Management Dynamic Memory Management 1 Goals of this Lecture Help you learn about: Dynamic memory management techniques Garbage collection by the run-time system (Java) Manual deallocation by the programmer (C, C++)

More information

VMem. By Stewart Lynch.

VMem. By Stewart Lynch. VMem By Stewart Lynch. 1 Contents Introduction... 3 Overview... 4 Getting started... 6 Fragmentation... 7 Virtual Regions... 8 The FSA... 9 Biasing... 10 The Coalesce allocator... 11 Skewing indices...

More information

CS 33. Storage Allocation. CS33 Intro to Computer Systems XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

CS 33. Storage Allocation. CS33 Intro to Computer Systems XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. CS 33 Storage Allocation CS33 Intro to Computer Systems XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. The Unix Address Space stack dynamic bss program break data text CS33 Intro to Computer

More information

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs Computational Optimization ISE 407 Lecture 16 Dr. Ted Ralphs ISE 407 Lecture 16 1 References for Today s Lecture Required reading Sections 6.5-6.7 References CLRS Chapter 22 R. Sedgewick, Algorithms in

More information

Binary heaps (chapters ) Leftist heaps

Binary heaps (chapters ) Leftist heaps Binary heaps (chapters 20.3 20.5) Leftist heaps Binary heaps are arrays! A binary heap is really implemented using an array! 8 18 29 20 28 39 66 Possible because of completeness property 37 26 76 32 74

More information

CSCI-UA /2. Computer Systems Organization Lecture 19: Dynamic Memory Allocation: Basics

CSCI-UA /2. Computer Systems Organization Lecture 19: Dynamic Memory Allocation: Basics Slides adapted (and slightly modified) from: Clark Barrett Jinyang Li Randy Bryant Dave O Hallaron CSCI-UA.0201-001/2 Computer Systems Organization Lecture 19: Dynamic Memory Allocation: Basics Mohamed

More information

Run-Time Environments/Garbage Collection

Run-Time Environments/Garbage Collection Run-Time Environments/Garbage Collection Department of Computer Science, Faculty of ICT January 5, 2014 Introduction Compilers need to be aware of the run-time environment in which their compiled programs

More information

9.1 Background. In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of

9.1 Background. In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of Chapter 9 MEMORY MANAGEMENT In Chapter 6, we showed how the CPU can be shared by a set of processes. As a result of CPU scheduling, we can improve both the utilization of the CPU and the speed of the computer's

More information

Chapter 11: Indexing and Hashing

Chapter 11: Indexing and Hashing Chapter 11: Indexing and Hashing Basic Concepts Ordered Indices B + -Tree Index Files B-Tree Index Files Static Hashing Dynamic Hashing Comparison of Ordered Indexing and Hashing Index Definition in SQL

More information

Q1. What is Deadlock? Explain essential conditions for deadlock to occur?

Q1. What is Deadlock? Explain essential conditions for deadlock to occur? II nd Midterm session 2017-18 Subject: Operating System ( V CSE-B ) Q1. What is Deadlock? Explain essential conditions for deadlock to occur? In a multiprogramming environment, several processes may compete

More information

Segmentation. Multiple Segments. Lecture Notes Week 6

Segmentation. Multiple Segments. Lecture Notes Week 6 At this point, we have the concept of virtual memory. The CPU emits virtual memory addresses instead of physical memory addresses. The MMU translates between virtual and physical addresses. Don't forget,

More information

COMPUTER SCIENCE 4500 OPERATING SYSTEMS

COMPUTER SCIENCE 4500 OPERATING SYSTEMS Last update: 3/28/2017 COMPUTER SCIENCE 4500 OPERATING SYSTEMS 2017 Stanley Wileman Module 9: Memory Management Part 1 In This Module 2! Memory management functions! Types of memory and typical uses! Simple

More information

CIS Operating Systems Memory Management. Professor Qiang Zeng Fall 2017

CIS Operating Systems Memory Management. Professor Qiang Zeng Fall 2017 CIS 5512 - Operating Systems Memory Management Professor Qiang Zeng Fall 2017 Previous class Uniprocessor policies FCFS, Shortest Job First Round Robin Multilevel Feedback Queue Multiprocessor policies

More information

Today. Dynamic Memory Allocation: Basic Concepts. Dynamic Memory Allocation. Dynamic Memory Allocation. malloc Example. The malloc Package

Today. Dynamic Memory Allocation: Basic Concepts. Dynamic Memory Allocation. Dynamic Memory Allocation. malloc Example. The malloc Package Today Dynamic Memory Allocation: Basic Concepts Basic concepts Performance concerns Approach 1: implicit free lists CSci 01: Machine Architecture and Organization Lecture #9, April th, 016 Your instructor:

More information

Introduction to Computer Systems /18 243, fall th Lecture, Oct. 22 th

Introduction to Computer Systems /18 243, fall th Lecture, Oct. 22 th Introduction to Computer Systems 15 213/18 243, fall 2009 16 th Lecture, Oct. 22 th Instructors: Gregory Kesden and Markus Püschel Today Dynamic memory allocation Process Memory Image %esp kernel virtual

More information

CS Operating Systems

CS Operating Systems CS 4500 - Operating Systems Module 9: Memory Management - Part 1 Stanley Wileman Department of Computer Science University of Nebraska at Omaha Omaha, NE 68182-0500, USA June 9, 2017 In This Module...

More information

CS Operating Systems

CS Operating Systems CS 4500 - Operating Systems Module 9: Memory Management - Part 1 Stanley Wileman Department of Computer Science University of Nebraska at Omaha Omaha, NE 68182-0500, USA June 9, 2017 In This Module...

More information

Memory Management. To do. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory

Memory Management. To do. q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory Management To do q Basic memory management q Swapping q Kernel memory allocation q Next Time: Virtual memory Memory management Ideal memory for a programmer large, fast, nonvolatile and cheap not

More information

CMSC 313 Spring 2010 Exam 3 May 17, 2010

CMSC 313 Spring 2010 Exam 3 May 17, 2010 CMSC 313 Spring 2010 Exam 3 May 17, 2010 Name Score UMBC Username Notes: a. Please write clearly. Unreadable answers receive no credit. b. There are no intentional syntax errors in any code provided with

More information

RxNetty vs Tomcat Performance Results

RxNetty vs Tomcat Performance Results RxNetty vs Tomcat Performance Results Brendan Gregg; Performance and Reliability Engineering Nitesh Kant, Ben Christensen; Edge Engineering updated: Apr 2015 Results based on The Hello Netflix benchmark

More information

Supplementary Material for The Generalized PatchMatch Correspondence Algorithm

Supplementary Material for The Generalized PatchMatch Correspondence Algorithm Supplementary Material for The Generalized PatchMatch Correspondence Algorithm Connelly Barnes 1, Eli Shechtman 2, Dan B Goldman 2, Adam Finkelstein 1 1 Princeton University, 2 Adobe Systems 1 Overview

More information

A tunable hybrid memory allocator q

A tunable hybrid memory allocator q The Journal of Systems and Software 79 (2006) 1051 1063 www.elsevier.com/locate/jss A tunable hybrid memory allocator q Yusuf Hasan a, *, J. Morris Chang b a Department of Computer Science, Illinois Institute

More information

Dynamic Memory Allocation: Basic Concepts

Dynamic Memory Allocation: Basic Concepts Dynamic Memory Allocation: Basic Concepts 15-213: Introduction to Computer Systems 19 th Lecture, March 30, 2017 Instructor: Franz Franchetti & Seth Copen Goldstein 1 Today Basic concepts Implicit free

More information