Perl Memory Use. Tim OSCON July 2012

Size: px
Start display at page:

Download "Perl Memory Use. Tim Bunce @ OSCON July 2012"

Transcription

1 Perl Memory Use Tim OSCON July

2 Scope of the talk... Not really "profiling" No leak detection No VM, page mapping, MMU, TLB, threads etc Linux focus Almost no copy-on-write No cats 2

3 Goals Give you a top-to-bottom overview Identify the key issues and complications Show you useful tools along the way Future plans 3

4 Ouch! $ perl some_script.pl Out of memory! $ $ perl some_script.pl Killed. $ $ perl some_script.pl $ Someone shouts: "Hey! My process has been killed!" $ perl some_script.pl [later] "Umm, what's taking so long?" 4

5 Process Memory 5

6 C Program Code int main(...) {... } Read-only Data eg String constants Read-write Data un/initialized variables Heap (not to scale!) Shared Lib Code \\ Shared Lib R/O Data repeated for each lib Shared Lib R/W Data // C Stack System (not the perl stack) 6

7 $ perl -e 'system("cat /proc/$$/stat")' 4752 (perl) S $ perl -e 'system("cat /proc/$$/statm")' $ perl -e 'system("ps -p $$ -o vsz,rsz,sz,size")' VSZ RSZ SZ SZ $ perl -e 'system("top -b -n1 -p $$")'... PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND tim m S :00.00 perl $ perl -e 'system("cat /proc/$$/status")'... VmPeak:! kb VmSize:! kb <- total (code, libs, stack, heap etc.) VmHWM:! 1760 kb VmRSS:! 1760 kb <- how much of the total is resident in physical memory VmData:! 548 kb <- data (heap) VmStk:! 92 kb <- stack VmExe:! 4 kb <- code VmLib:! 4220 kb <- libs, including libperl.so VmPTE:! 84 kb VmPTD:! 28 kb VmSwap:! 0 kb... Further info on unix.stackexchange.com 7

8 $ perl -e 'system("cat /proc/$$/maps")' address perms... pathname r-xp... /.../perl-5.nn.n/bin/perl rw-p... /.../perl-5.nn.n/bin/perl 0087f c1000 rw-p... [heap] 7f858cba1000-7f8592a32000 r--p... 7f8592c f8592e1a000 r-xp... 7f8592e1a000-7f859301a p... 7f859301a000-7f859301e000 r--p... 7f859301e000-7f859301f000 rw-p... 7f859301f000-7f rw-p... /usr/lib/locale/locale-archive-rpm /lib64/libc-2.12.so /lib64/libc-2.12.so /lib64/libc-2.12.so /lib64/libc-2.12.so...other libs... 7f8593d1b000-7f8593e7c000 r-xp... 7f8593e7c000-7f859407c p... 7f859407c000-7f rw-p... 7f85942a6000-7f85942a7000 rw-p... /.../lib/5.nn.n/x86_64-linux/core/libperl.so /.../lib/5.nn.n/x86_64-linux/core/libperl.so /.../lib/5.nn.n/x86_64-linux/core/libperl.so 7fff fff6129a000 rw-p... [stack] 7fff613fe000-7fff r-xp... [vdso] ffffffffff ffffffffff r-xp... [vsyscall] 8

9 $ perl -e 'system("cat /proc/$$/smaps")' # note smaps not maps address... perms... pathname 7fb00fbc1000-7fb00fd22000 r-xp... /.../5.10.1/x86_64-linux/CORE/libperl.so Size: 1412 kb <- size of executable code in libperl.so Rss: 720 kb <- amount that's in physical memory Pss: 364 kb Shared_Clean: 712 kb Shared_Dirty: 0 kb Private_Clean: 8 kb Private_Dirty: 0 kb Referenced: 720 kb Anonymous: 0 kb AnonHugePages: 0 kb Swap: 0 kb KernelPageSize: 4 kb MMUPageSize: 4 kb... repeated detail for every mapped item... Process view: everything exists in sequential contiguous physical memory. Simple. System view: chunks of physical memory are mapped into place and loaded on demand, then taken away again when the process isn't looking. 9

10 C Program Code Read-only Data Read-write Data Heap To the program everything appears to be in physical memory. In reality that s rarely the case. Memory is divided into pages Page size is typically 4KB Page resident in physical memory Page not resident Shared Lib Code Shared Lib R/O Data Shared Lib R/W Data Pages: are loaded when first used may be paged out when the system needs the physical memory may be shared with other processes may be copy-on-write, where are shared page becomes private when first written to C Stack System 10

11 Key Points Pages of a process can be paged out if the system wants the physical memory. So Resident Set Size (RSS) can shrink even while the overall process size grows. Re private/shared/copy-on-write: If a page is currently paged out its attributes are paged out as well. In this case a page is neither reported as private nor as shared. It is only included in the process size. So be careful to understand what you re actually measuring! Generally total memory size is a good indicator. 11

12 Low-Level Modules BSD::Resource - getrusage() system call (limited on Linux) BSD::Process - Only works on BSD, not Linux Proc::ProcessTable - Interesting but buggy Linux::Smaps - very detailed, but only works on Linux GTop - Perl interface to libgtop, better but external dependency 12

13 Higher-Level Modules Memory::Usage Reads /proc/$pid/statm. Reports changes on demand. Dash::Leak Uses BSD::Process. Reports changes on demand. Devel::MemoryTrace::Light Uses GTop or BSD::Process. Automatically prints a message when memory use grows, pointing to a particular line number. Defaults to tracking Resident Set Size! 13

14 Other Modules Devel::Plumber - memory leak finder for C programs Uses GDB to walk internal glibc heap structures. Can work on either a live process or a core file. Treats the C heap of the program under test as a collection of non-overlapping blocks, and classifies them into one of four states. Devel::Memalyzer - Base framework for analyzing program memory usage Runs and monitors a subprocess via plugins that read /proc smaps and status at regular intervals. Memchmark - Check memory consumption Memchmark forks a new process to run the sub and then monitors its memory usage every 100ms (approx.) recording the maximum amount used. 14

15 A Peak at The Heap 15

16 Heap Your data goes here Perl uses malloc() and free() to manage the space malloc has its own issues (overheads, bucket sizes, fragmentation etc. etc.) Perl uses its own malloc code on some systems On top of malloc perl has it s own layer of memory management (e.g. arenas) for some data types 16

17 Perl Data Memory 17

18 Data Anatomy Examples Integer (IV) String (PV) Number with a string Head Body Data Illustrations from illguts 18

19 Array (IV) Hash (HV) 19

20 Glob (GV) Symbol Table (Stash) Sub Pad List lots of tiny chunks! 20

21 Notes All Heads and Bodies are allocated from arenas managed by perl efficient, low overhead and no fragmentation but arena space for a given data type is never freed or repurposed All variable length data storage comes from malloc higher overheads, bucket and fragmentation issues Summing the apparent size of a data structure will underestimate the actual space cost. 21

22 Arenas $ perl -MDevel::Gladiator=arena_table -e 'warn arena_table()' ARENA COUNTS: 1063 SCALAR 199 GLOB 120 ARRAY 95 CODE 66 HASH 8 REGEXP 5 REF 4 IO::File 3 REF-ARRAY 2 FORMAT 1 version 1 REF-HASH 1 REF-version arena_table() formats the hash return by arena_ref_counts() which summarizes the list of all SVs returned by walk_arenas(). 22

23 Devel::Peek Gives you a textual view of the data structures $ perl -MDevel::Peek -e '%a = (42 => "Hello World!"); Dump(\%a)' SV = IV(0x1332fd0) at 0x1332fe0 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x SV = PVHV(0x ) at 0x REFCNT = 2 FLAGS = (SHAREKEYS) ARRAY = 0x (0:7, 1:1) hash quality = 100.0% KEYS = 1 FILL = 1 MAX = 7 RITER = -1 EITER = 0x0 Elt "42" HASH = 0x73caace8 SV = PV(0x ) at 0x1332de8 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x133f960 "Hello World!"\0 CUR = 12 <= length in use LEN = 16 <= amount allocated 23

24 Devel::Size Gives you a measure of the size of a data structures $ perl -MDevel::Size=total_size -Minteger -le 'print total_size( 0 )' 24 $ perl -MDevel::Size=total_size -Minteger -le 'print total_size( [] )' 64 $ perl -MDevel::Size=total_size -Minteger -le 'print total_size( {} )' 120 $ perl -MDevel::Size=total_size -le 'print total_size( [ ] )' 3264 Makes somewhat arbitrary decisions about what to include for non-data types Doesn't or can't accurately measure subs, forms, regexes, and IOs. Can't measure 'everything' (total_size(\%main::) is the best we can do) But it's generally accurate for typical use and is very fast. 24

25 Space in Hiding Perl tends to use memory to save time This can lead to surprises, for example: sub foo { my $var = "#" x 2**20; } foo(); # ~1MB still used after return sub bar{ my $var = "#" x 2**20; bar($_[0]-1) if $_[0]; # recurse } bar(50); # ~50MB still used after return 25

26 Devel::Size 0.77 perl -MDevel::Size=total_size -we ' sub foo { my $var = "#" x 2**20; foo($_[0]-1) if $_[0]; 1 } system("grep VmData /proc/$$/status"); printf "%d kb\n", total_size(\&foo)/1024; foo(50); system("grep VmData /proc/$$/status"); printf "%d kb\n", total_size(\&foo)/1024; ' VmData:! 796 kb 7 kb VmData:! kb 8 kb VmData grew by ~100MB but we expected ~50MB. Not sure why. Devel::Size 0.77 doesn't measure what's in sub pads (lexicals). 26

27 Devel::Size hacks perl -MDevel::Size=total_size -we ' sub foo { my $var = "#" x 2**20; foo($_[0]-1) if $_[0];1 } system("grep VmData /proc/$$/status"); printf "%d kb\n", total_size(\&foo)/1024; foo(50); system("grep VmData /proc/$$/status"); printf "%d kb\n", total_size(\&foo)/1024; ' VmData:! 796 kb 293 kb VmData:! kb kb Now does include the pad variables. But note the 293 kb initial value - it's measuring too much. Work in progress. 27

28 Devel::Size hacks $ report='printf "total_size %6d kb\n", total_size(\%main::)/1024; system("grep VmData /proc/$$/status")' $ perl -MDevel::Size=total_size -we $report total_size 290 kb VmData: 800 kb $ perl -MMoose -MDevel::Size=total_size -we $report total_size 9474 kb! [ = kb ] VmData: kb! [ = kb ] What accounts for the 1840 kb difference in the increases? -Arenas and other perl-internals aren't included -Limitations of Devel::Size measuring subs and regexs -Malloc heap buckets and fragmentation 28

29 Malloc and The Heap 29

30 Malloc and The Heap 30

31 malloc manages memory allocation Heap perl data Requests big chunks of memory from the operating system as needed. Almost never returns it! Perl makes lots of alloc and free requests. Freed fragments of various sizes accumulate. 31

32 $ man malloc "When allocating blocks of memory larger than MMAP_THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2). MMAP_THRESHOLD is 128 kb by default, but is adjustable using mallopt(3)." That's for RHEL/CentOS 6. Your mileage may vary. Space vs speed trade-off: mmap() and munmap() probably slower. Other malloc implementations can be used via LD_PRELOAD env var. e.g. export LD_PRELOAD="/usr/lib/libtcmalloc.so" 32

33 PERL_DEBUG_MSTATS * * Requires a perl configured to use it's own malloc (-Dusemymalloc) $ PERL_DEBUG_MSTATS=1 perl -MMoose -MDevel::Size=total_size -we "$report" total_size 9474 kb! [ = kb ] VmData: kb! [ = kb ] Memory allocation statistics after execution: (buckets 8(8) (65536) free: ! used: ! Total sbrk(): /1487:-13. Odd ends: pad+heads+chain+tail: There's 419 kb (" free") is sitting in unused malloc buckets. See perldebguts and Devel::Peek docs for details. Also Devel::Mallinfo. Note Devel::Size total_size() says 9474 kb but malloc says only 6154 kb allocated! 33

34 Key Notes Perl uses malloc to manage heap memory Malloc uses sized buckets and free lists etc. Malloc has overheads Freed chunks of various sizes accumulate Large allocations may use mmap()/munmap() Your malloc maybe tunable 34

35 Memory Profiling 35

36 What does that mean? Track memory size over time? "Memory went up 53 kb while in sub foo" Has to be done by internals not proc size Experimental NYTProf patch by Nicholas Measured memory instead of CPU time Turned out to not seem very useful 36

37 The Plan 37

38 The Cunning Plan 38

39 The D r aft Plan Add a function to Devel::Size to return the size of everything. including arenas and malloc overheads (where knowable) try to get as close to VmData value as possible Add a C-level callback hook Add some kind of "data path name" chain for the callback to use Add multi-phase scan 1: start via symbol tables, note & skip where ref count > 1 2: process all the skipped items (ref chains into unnamed data) 3: scan arenas for leaked values (not seen in scan 1 or 2) Write all the name=>size data to disk Write tool to visualize it (e.g. HTML treemap like NYTProf) Write tool to diff two sets of data 39

40 Questions? on twitter 40

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc()

Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() CS61: Systems Programming and Machine Organization Harvard University, Fall 2009 Lecture 10: Dynamic Memory Allocation 1: Into the jaws of malloc() Prof. Matt Welsh October 6, 2009 Topics for today Dynamic

More information

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

Virtual Memory. How is it possible for each process to have contiguous addresses and so many of them? A System Using Virtual Addressing How is it possible for each process to have contiguous addresses and so many of them? Computer Systems Organization (Spring ) CSCI-UA, Section Instructor: Joanna Klukowska Teaching Assistants: Paige Connelly

More information

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1

Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1 Virtual Memory Behavior in Red Hat Linux Advanced Server 2.1 Bob Matthews Red Hat, Inc. Kernel Development Team Norm Murray Red Hat, Inc. Client Engineering Team This is an explanation of the virtual memory

More information

Channel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG

Channel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG Channel Access Client Programming Andrew Johnson Computer Scientist, AES-SSG Channel Access The main programming interface for writing Channel Access clients is the library that comes with EPICS base Written

More information

Large system usage HOW TO. George Magklaras PhD Biotek/NCMM IT USIT Research Computing Services

Large system usage HOW TO. George Magklaras PhD Biotek/NCMM IT USIT Research Computing Services Large system usage HOW TO George Magklaras PhD Biotek/NCMM IT USIT Research Computing Services Agenda Introduction: A Linux server as a collection of memory/disk/cpu What is the problem? memory and SWAP

More information

Leak Check Version 2.1 for Linux TM

Leak Check Version 2.1 for Linux TM Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information

More information

Memory Management under Linux: Issues in Linux VM development

Memory Management under Linux: Issues in Linux VM development Memory Management under Linux: Issues in Linux VM development Christoph Lameter, Ph.D. Technical Lead, Linux Kernel Software Silicon Graphics Inc. clameter@sgi.com 2008-03-12 2008 SGI Sunnyvale, California

More information

These sub-systems are all highly dependent on each other. Any one of them with high utilization can easily cause problems in the other.

These sub-systems are all highly dependent on each other. Any one of them with high utilization can easily cause problems in the other. Abstract: The purpose of this document is to describe how to monitor Linux operating systems for performance. This paper examines how to interpret common Linux performance tool output. After collecting

More information

Physical Memory RAM. The kernel keeps track of how it is used

Physical Memory RAM. The kernel keeps track of how it is used Virtual Memory Physical Memory RAM The kernel keeps track of how it is used Physical Memory RAM Kernel and hardware typically with it in pages Usually- 4k on 32-bit architectures 8k on 64-bit architectures

More information

KVM & Memory Management Updates

KVM & Memory Management Updates KVM & Memory Management Updates KVM Forum 2012 Rik van Riel Red Hat, Inc. KVM & Memory Management Updates EPT Accessed & Dirty Bits 1GB hugepages Balloon vs. Transparent Huge Pages Automatic NUMA Placement

More information

NCCS Brown Bag Series

NCCS Brown Bag Series NCCS Brown Bag Series Tips for Monitoring Memory Usage in PBS jobs on Discover Chongxun (Doris) Pan doris.pan@nasa.gov October 16, 2012 After the talk, you will understand -- What s memory swapping, really?

More information

System-wide Memory Management for Linux Embedded Systems Revision 1.0

System-wide Memory Management for Linux Embedded Systems Revision 1.0 System-wide Memory Management for Linux Embedded Systems Revision 1.0 Presented by: Howard Cochran cochran@lexmark.com Lexmark International at: Embedded Linux Conference February, 2013 Agenda The Problem:

More information

Jonathan Worthington Scarborough Linux User Group

Jonathan Worthington Scarborough Linux User Group Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.

More information

Chapter 12 File Management

Chapter 12 File Management Operating Systems: Internals and Design Principles Chapter 12 File Management Eighth Edition By William Stallings Files Data collections created by users The File System is one of the most important parts

More information

Visual Basic Programming. An Introduction

Visual Basic Programming. An Introduction Visual Basic Programming An Introduction Why Visual Basic? Programming for the Windows User Interface is extremely complicated. Other Graphical User Interfaces (GUI) are no better. Visual Basic provides

More information

Get the Better of Memory Leaks with Valgrind Whitepaper

Get the Better of Memory Leaks with Valgrind Whitepaper WHITE PAPER Get the Better of Memory Leaks with Valgrind Whitepaper Memory leaks can cause problems and bugs in software which can be hard to detect. In this article we will discuss techniques and tools

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

How To Write To A Linux Memory Map On A Microsoft Zseries 2.2.2 (Amd64) On A Linux 2.3.2 2.4.2 3.5.2 4.5 (Amd32) (

How To Write To A Linux Memory Map On A Microsoft Zseries 2.2.2 (Amd64) On A Linux 2.3.2 2.4.2 3.5.2 4.5 (Amd32) ( Understanding Linux Memory Management SHARE 102 Session 9241 Dr. Ulrich Weigand Linux on zseries Development, IBM Lab Böblingen Ulrich.Weigand@de.ibm.com Linux Memory Management - A Mystery? What does

More information

CS5460: Operating Systems

CS5460: Operating Systems CS5460: Operating Systems Lecture 13: Memory Management (Chapter 8) Where are we? Basic OS structure, HW/SW interface, interrupts, scheduling Concurrency Memory management Storage management Other topics

More information

Local and Remote Memory: Memory in a Linux/NUMA System

Local and Remote Memory: Memory in a Linux/NUMA System SGI 2006 Remote and Local Memory 1 Local and Remote Memory: Memory in a Linux/NUMA System Jun 20 th, 2006 by Christoph Lameter, Ph.D. christoph@lameter.com 2006 Silicon Graphics, Inc. Memory seems to be

More information

Advanced Bash Scripting. Joshua Malone (jmalone@ubergeeks.com)

Advanced Bash Scripting. Joshua Malone (jmalone@ubergeeks.com) Advanced Bash Scripting Joshua Malone (jmalone@ubergeeks.com) Why script in bash? You re probably already using it Great at managing external programs Powerful scripting language Portable and version-stable

More information

The World According to the OS. Operating System Support for Database Management. Today s talk. What we see. Banking DB Application

The World According to the OS. Operating System Support for Database Management. Today s talk. What we see. Banking DB Application The World According to the OS Operating System Support for Database Management App1 App2 App3 notes from Stonebraker s paper that appeared in Computing Practices, 1981 Operating System Anastassia Ailamaki

More information

NetBeans Profiler is an

NetBeans Profiler is an NetBeans Profiler Exploring the NetBeans Profiler From Installation to a Practical Profiling Example* Gregg Sporar* NetBeans Profiler is an optional feature of the NetBeans IDE. It is a powerful tool that

More information

Safety measures in Linux

Safety measures in Linux S a f e t y m e a s u r e s i n L i n u x Safety measures in Linux Krzysztof Lichota lichota@mimuw.edu.pl A g e n d a Standard Unix security measures: permissions, capabilities, ACLs, chroot Linux kernel

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Sitecore Health. Christopher Wojciech. netzkern AG. christopher.wojciech@netzkern.de. Sitecore User Group Conference 2015

Sitecore Health. Christopher Wojciech. netzkern AG. christopher.wojciech@netzkern.de. Sitecore User Group Conference 2015 Sitecore Health Christopher Wojciech netzkern AG christopher.wojciech@netzkern.de Sitecore User Group Conference 2015 1 Hi, % Increase in Page Abondonment 40% 30% 20% 10% 0% 2 sec to 4 2 sec to 6 2 sec

More information

The Classical Architecture. Storage 1 / 36

The Classical Architecture. Storage 1 / 36 1 / 36 The Problem Application Data? Filesystem Logical Drive Physical Drive 2 / 36 Requirements There are different classes of requirements: Data Independence application is shielded from physical storage

More information

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

Intel P6 Systemprogrammering 2007 Föreläsning 5 P6/Linux Memory System Intel P6 Systemprogrammering 07 Föreläsning 5 P6/Linux ory System Topics P6 address translation Linux memory management Linux page fault handling memory mapping Internal Designation for Successor to Pentium

More information

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

Memory Management Outline. Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging Memory Management Outline Background Swapping Contiguous Memory Allocation Paging Segmentation Segmented Paging 1 Background Memory is a large array of bytes memory and registers are only storage CPU can

More information

Drupal Performance Tuning

Drupal Performance Tuning Drupal Performance Tuning By Jeremy Zerr Website: http://www.jeremyzerr.com @jrzerr http://www.linkedin.com/in/jrzerr Overview Basics of Web App Systems Architecture General Web

More information

Chapter 12 File Management

Chapter 12 File Management Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 12 File Management Dave Bremer Otago Polytechnic, N.Z. 2008, Prentice Hall Roadmap Overview File organisation and Access

More information

Watch your Flows with NfSen and NFDUMP 50th RIPE Meeting May 3, 2005 Stockholm Peter Haag

Watch your Flows with NfSen and NFDUMP 50th RIPE Meeting May 3, 2005 Stockholm Peter Haag Watch your Flows with NfSen and NFDUMP 50th RIPE Meeting May 3, 2005 Stockholm Peter Haag 2005 SWITCH What I am going to present: The Motivation. What are NfSen and nfdump? The Tools in Action. Outlook

More information

Chapter 12 File Management. Roadmap

Chapter 12 File Management. Roadmap Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 12 File Management Dave Bremer Otago Polytechnic, N.Z. 2008, Prentice Hall Overview Roadmap File organisation and Access

More information

Tech Tip: Understanding Server Memory Counters

Tech Tip: Understanding Server Memory Counters Tech Tip: Understanding Server Memory Counters Written by Bill Bach, President of Goldstar Software Inc. This tech tip is the second in a series of tips designed to help you understand the way that your

More information

Segmentation and Fragmentation

Segmentation and Fragmentation Segmentation and Fragmentation Operating System Design MOSIG 1 Instructor: Arnaud Legrand Class Assistants: Benjamin Negrevergne, Sascha Hunold September 16, 2010 A. Legrand Segmentation and Fragmentation

More information

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems File Performance and Reliability Andy Bavier Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall10/cos318/ Topics File buffer cache

More information

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

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture Review from last time CS 537 Lecture 3 OS Structure What HW structures are used by the OS? What is a system call? Michael Swift Remzi Arpaci-Dussea, Michael Swift 1 Remzi Arpaci-Dussea, Michael Swift 2

More information

Determining the Correct Usage of Swap in Linux * 2.6 Kernels

Determining the Correct Usage of Swap in Linux * 2.6 Kernels Technical White Paper LINUX OPERATING SYSTEMS www.novell.com Determining the Correct Usage of Swap in Linux * 2.6 Kernels Determining the Correct Usage of Swap in Linux 2.6 Kernels Table of Contents: 2.....

More information

Virtualization in Linux KVM + QEMU

Virtualization in Linux KVM + QEMU CS695 Topics in Virtualization and Cloud Computing KVM + QEMU Senthil, Puru, Prateek and Shashank 1 Topics covered KVM and QEMU Architecture VTx support CPU virtualization in KMV Memory virtualization

More information

Lecture 17: Virtual Memory II. Goals of virtual memory

Lecture 17: Virtual Memory II. Goals of virtual memory Lecture 17: Virtual Memory II Last Lecture: Introduction to virtual memory Today Review and continue virtual memory discussion Lecture 17 1 Goals of virtual memory Make it appear as if each process has:

More information

Rational Application Developer Performance Tips Introduction

Rational Application Developer Performance Tips Introduction Rational Application Developer Performance Tips Introduction This article contains a series of hints and tips that you can use to improve the performance of the Rational Application Developer. This article

More information

Memory Usage of a Software Communication Architecture Waveform

Memory Usage of a Software Communication Architecture Waveform Memory Usage of a Software Communication Architecture Waveform Philip J. Balister Wireless@VT 432 Durham Hall, Mail Code 350 Blacksburg, VA 24061 balister@vt.edu Carl Dietrich Wireless@VT 432 Durham Hall,

More information

Virtual vs Physical Addresses

Virtual vs Physical Addresses Virtual vs Physical Addresses Physical addresses refer to hardware addresses of physical memory. Virtual addresses refer to the virtual store viewed by the process. virtual addresses might be the same

More information

HP Service Manager Shared Memory Guide

HP Service Manager Shared Memory Guide HP Service Manager Shared Memory Guide Shared Memory Configuration, Functionality, and Scalability Document Release Date: December 2014 Software Release Date: December 2014 Introduction to Shared Memory...

More information

ELEC 377. Operating Systems. Week 1 Class 3

ELEC 377. Operating Systems. Week 1 Class 3 Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation

More information

Application-Level Debugging and Profiling: Gaps in the Tool Ecosystem. Dr Rosemary Francis, Ellexus

Application-Level Debugging and Profiling: Gaps in the Tool Ecosystem. Dr Rosemary Francis, Ellexus Application-Level Debugging and Profiling: Gaps in the Tool Ecosystem Dr Rosemary Francis, Ellexus For years instruction-level debuggers and profilers have improved in leaps and bounds. Similarly, system-level

More information

Linux VM Infrastructure for memory power management

Linux VM Infrastructure for memory power management Linux VM Infrastructure for memory power management Ankita Garg Vaidyanathan Srinivasan IBM Linux Technology Center Agenda - Saving Power Motivation - Why Save Power Benefits How can it be achieved Role

More information

An analysis of how static and shared libraries affect memory usage on an IP-STB

An analysis of how static and shared libraries affect memory usage on an IP-STB An analysis of how static and shared libraries affect memory usage on an IP-STB Master of Science Thesis in the Programme Networks and Distributed Systems Dongping Huang Chalmers University of Technology

More information

FAWN - a Fast Array of Wimpy Nodes

FAWN - a Fast Array of Wimpy Nodes University of Warsaw January 12, 2011 Outline Introduction 1 Introduction 2 3 4 5 Key issues Introduction Growing CPU vs. I/O gap Contemporary systems must serve millions of users Electricity consumed

More information

Virtual Memory. Chapter 4

Virtual Memory. Chapter 4 Chapter 4 Virtual Memory Linux processes execute in a virtual environment that makes it appear as if each process had the entire address space of the CPU available to itself. This virtual address space

More information

Operating System and Process Monitoring Tools

Operating System and Process Monitoring Tools http://www.cse.wustl.edu/~jain/cse567-06/ftp/os_monitors/index.html 1 of 12 Operating System and Process Monitoring Tools Arik Brooks, awb1@wustl.edu Abstract: Monitoring the performance of operating systems

More information

COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File

COS 318: Operating Systems. File Layout and Directories. Topics. File System Components. Steps to Open A File Topics COS 318: Operating Systems File Layout and Directories File system structure Disk allocation and i-nodes Directory and link implementations Physical layout for performance 2 File System Components

More information

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure CSE 120 Principles of Operating Systems Fall 2000 Lecture 3: Operating System Modules, Interfaces, and Structure Geoffrey M. Voelker Modules, Interfaces, Structure We roughly defined an OS as the layer

More information

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

Memory Management CS 217. Two programs can t control all of memory simultaneously Memory Management CS 217 Memory Management Problem 1: Two programs can t control all of memory simultaneously Problem 2: One program shouldn t be allowed to access/change the memory of another program

More information

Survey of Filesystems for Embedded Linux. Presented by Gene Sally CELF

Survey of Filesystems for Embedded Linux. Presented by Gene Sally CELF Survey of Filesystems for Embedded Linux Presented by Gene Sally CELF Presentation Filesystems In Summary What is a filesystem Kernel and User space filesystems Picking a root filesystem Filesystem Round-up

More information

Valgrind BoF Ideas, new features and directions

Valgrind BoF Ideas, new features and directions Valgrind BoF Ideas, new features and directions Everybody! Valgrind developers and users are encouraged to participate by joining the discussion. And of course by kindly (or bitterly:) complain about bugs

More information

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation Dynamic Storage Allocation CS 44 Operating Systems Fall 5 Presented By Vibha Prasad Memory Allocation Static Allocation (fixed in size) Sometimes we create data structures that are fixed and don t need

More information

W4118: segmentation and paging. Instructor: Junfeng Yang

W4118: segmentation and paging. Instructor: Junfeng Yang W4118: segmentation and paging Instructor: Junfeng Yang Outline Memory management goals Segmentation Paging TLB 1 Uni- v.s. multi-programming Simple uniprogramming with a single segment per process Uniprogramming

More information

tmpfs: A Virtual Memory File System

tmpfs: A Virtual Memory File System tmpfs: A Virtual Memory File System Peter Snyder Sun Microsystems Inc. 2550 Garcia Avenue Mountain View, CA 94043 ABSTRACT This paper describes tmpfs, a memory-based file system that uses resources and

More information

In order to understand Perl objects, you first need to understand references in Perl. See perlref for details.

In order to understand Perl objects, you first need to understand references in Perl. See perlref for details. NAME DESCRIPTION perlobj - Perl object reference This document provides a reference for Perl's object orientation features. If you're looking for an introduction to object-oriented programming in Perl,

More information

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

Where is the memory going? Memory usage in the 2.6 kernel Where is the memory going? Memory usage in the 2.6 kernel Sep 2006 Andi Kleen, SUSE Labs ak@suse.de Why save memory Weaker reasons "I ve got 1GB of memory. Why should I care about memory?" Old machines

More information

Google App Engine. Guido van Rossum Stanford EE380 Colloquium, Nov 5, 2008

Google App Engine. Guido van Rossum Stanford EE380 Colloquium, Nov 5, 2008 Google App Engine Guido van Rossum Stanford EE380 Colloquium, Nov 5, 2008 Google App Engine Does one thing well: running web apps Simple app configuration Scalable Secure 2 App Engine Does One Thing Well

More information

Part II. Managing Issues

Part II. Managing Issues Managing Issues Part II. Managing Issues If projects are the most important part of Redmine, then issues are the second most important. Projects are where you describe what to do, bring everyone together,

More information

Container-based operating system virtualization: a scalable, high-performance alternative to hypervisors

Container-based operating system virtualization: a scalable, high-performance alternative to hypervisors Container-based operating system virtualization: a scalable, high-performance alternative to hypervisors Soltesz, et al (Princeton/Linux-VServer), Eurosys07 Context: Operating System Structure/Organization

More information

TELE 301 Lecture 7: Linux/Unix file

TELE 301 Lecture 7: Linux/Unix file Overview Last Lecture Scripting This Lecture Linux/Unix file system Next Lecture System installation Sources Installation and Getting Started Guide Linux System Administrators Guide Chapter 6 in Principles

More information

Understanding Virtual Memory In Red Hat Enterprise Linux 3

Understanding Virtual Memory In Red Hat Enterprise Linux 3 Understanding Virtual Memory In Red Hat Enterprise Linux 3 Norm Murray and Neil Horman Version 1.6 December 13, 2005 Contents 1 Introduction 2 2 Definitions 3 2.1 What Comprises a VM........................

More information

Maximizing VMware ESX Performance Through Defragmentation of Guest Systems. Presented by

Maximizing VMware ESX Performance Through Defragmentation of Guest Systems. Presented by Maximizing VMware ESX Performance Through Defragmentation of Guest Systems Presented by July, 2010 Table of Contents EXECUTIVE OVERVIEW 3 TEST EQUIPMENT AND METHODS 4 TESTING OVERVIEW 5 Fragmentation in

More information

2 2011 Oracle Corporation Proprietary and Confidential

2 2011 Oracle Corporation Proprietary and Confidential The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material,

More information

Virtuozzo Virtualization SDK

Virtuozzo Virtualization SDK Virtuozzo Virtualization SDK Programmer's Guide February 18, 2016 Copyright 1999-2016 Parallels IP Holdings GmbH and its affiliates. All rights reserved. Parallels IP Holdings GmbH Vordergasse 59 8200

More information

Benchmarking Hadoop & HBase on Violin

Benchmarking Hadoop & HBase on Violin Technical White Paper Report Technical Report Benchmarking Hadoop & HBase on Violin Harnessing Big Data Analytics at the Speed of Memory Version 1.0 Abstract The purpose of benchmarking is to show advantages

More information

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio. Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Names, Bindings, and Scopes A name is a symbolic identifier used

More information

Optimizing Linux Performance

Optimizing Linux Performance Optimizing Linux Performance Why is Performance Important Regular desktop user Not everyone has the latest hardware Waiting for an application to open Application not responding Memory errors Extra kernel

More information

Topics in Computer System Performance and Reliability: Storage Systems!

Topics in Computer System Performance and Reliability: Storage Systems! CSC 2233: Topics in Computer System Performance and Reliability: Storage Systems! Note: some of the slides in today s lecture are borrowed from a course taught by Greg Ganger and Garth Gibson at Carnegie

More information

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

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 CS 377: Operating Systems Lecture 25 - Linux Case Study Guest Lecturer: Tim Wood Outline Linux History Design Principles System Overview Process Scheduling Memory Management File Systems A review of what

More information

Tunable Base Page Size

Tunable Base Page Size Tunable Base Page Size Table of Contents Executive summary... 1 What is Tunable Base Page Size?... 1 How Base Page Size Affects the System... 1 Integrity Virtual Machines Platform Manager... 2 Working

More information

System performance monitoring in RTMT

System performance monitoring in RTMT System performance monitoring in RTMT About performance monitoring in RTMT, page 1 System summary and server status monitoring, page 3 IM and Presence and Cisco Jabber summary monitoring, page 6 About

More information

Virtual server management: Top tips on managing storage in virtual server environments

Virtual server management: Top tips on managing storage in virtual server environments Tutorial Virtual server management: Top tips on managing storage in virtual server environments Sponsored By: Top five tips for managing storage in a virtual server environment By Eric Siebert, Contributor

More information

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

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

More information

File System Management

File System Management Lecture 7: Storage Management File System Management Contents Non volatile memory Tape, HDD, SSD Files & File System Interface Directories & their Organization File System Implementation Disk Space Allocation

More information

EECS 354 Network Security. Introduction

EECS 354 Network Security. Introduction EECS 354 Network Security Introduction Why Learn To Hack Understanding how to break into computer systems allows you to better defend them Learn how to think like an attacker Defense then becomes second-nature

More information

Hands-On UNIX Exercise:

Hands-On UNIX Exercise: Hands-On UNIX Exercise: This exercise takes you around some of the features of the shell. Even if you don't need to use them all straight away, it's very useful to be aware of them and to know how to deal

More information

Effects of Memory Randomization, Sanitization and Page Cache on Memory Deduplication

Effects of Memory Randomization, Sanitization and Page Cache on Memory Deduplication Effects of Memory Randomization, Sanitization and Page Cache on Memory Deduplication Kuniyasu Suzaki, Kengo Iijima, Toshiki Yagi, Cyrille Artho Research Institute for Secure Systems EuroSec 2012 at Bern,

More information

Zing Vision. Answering your toughest production Java performance questions

Zing Vision. Answering your toughest production Java performance questions Zing Vision Answering your toughest production Java performance questions Outline What is Zing Vision? Where does Zing Vision fit in your Java environment? Key features How it works Using ZVRobot Q & A

More information

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015 Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10

More information

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management

1 File Management. 1.1 Naming. COMP 242 Class Notes Section 6: File Management COMP 242 Class Notes Section 6: File Management 1 File Management We shall now examine how an operating system provides file management. We shall define a file to be a collection of permanent data with

More information

Comparison of Memory Balloon Controllers

Comparison of Memory Balloon Controllers Comparison of Memory Balloon Controllers Presented by: PNVS Ravali Advisor: Prof. Purushottam Kulkarni June 25, 2015 Ravali, CSE, IIT Bombay M.Tech. Project Stage 2 1/34 Memory Overcommitment I Server

More information

Chapter 3 Operating-System Structures

Chapter 3 Operating-System Structures 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

Application Performance in the Cloud

Application Performance in the Cloud Application Performance in the Cloud Understanding and ensuring application performance in highly elastic environments Albert Mavashev, CTO Nastel Technologies, Inc. amavashev@nastel.com What is Cloud?

More information

CSE 403. Performance Profiling Marty Stepp

CSE 403. Performance Profiling Marty Stepp CSE 403 Performance Profiling Marty Stepp 1 How can we optimize it? public static String makestring() { String str = ""; for (int n = 0; n < REPS; n++) { str += "more"; } return str; } 2 How can we optimize

More information

Performance Tuning and Optimization for high traffic Drupal sites. Khalid Baheyeldin Drupal Camp, Toronto May 11 12, 2007

Performance Tuning and Optimization for high traffic Drupal sites. Khalid Baheyeldin Drupal Camp, Toronto May 11 12, 2007 Performance Tuning and Optimization for high traffic Drupal sites Khalid Baheyeldin Drupal Camp, Toronto May 11 12, 2007 Agenda Introduction The LAMP Stack Linux, Apache, MySQL, PHP Drupal Database queries

More information

Linux Profiling and Optimization The Black Art of Linux Performance Tuning. Federico Lucifredi Platform Orchestra Director Novell, INC

Linux Profiling and Optimization The Black Art of Linux Performance Tuning. Federico Lucifredi Platform Orchestra Director Novell, INC Linux Profiling and Optimization The Black Art of Linux Performance Tuning Federico Lucifredi Platform Orchestra Director Novell, INC 0 - Rationales System Optimization Rationales What are we optimizing?

More information

Rethink Package Components on De-Duplication: From Logical Sharing to Physical Sharing

Rethink Package Components on De-Duplication: From Logical Sharing to Physical Sharing Rethink Package Components on De-Duplication: From Logical Sharing to Physical Sharing Leaflet is wrong Kuniyashu Kuniyasu Suzaki, Toshiki Yagi, Kengo Iijima, Nguyen Anh Quynh, Cyrille Artho Research Center

More information

Running SMB3.x over RDMA on Linux platforms

Running SMB3.x over RDMA on Linux platforms Running SMB3.x over RDMA on Linux platforms Mark Rabinovich Visuality Systems John Kim Mellanox Technologies Prehistory NQ CIFS is an implementation of SMB client/server for the embedded world: Consumer

More information

System Calls and Standard I/O

System Calls and Standard I/O System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services

More information

Buffer Overflows. Security 2011

Buffer Overflows. Security 2011 Buffer Overflows Security 2011 Memory Organiza;on Topics Kernel organizes memory in pages Typically 4k bytes Processes operate in a Virtual Memory Space Mapped to real 4k pages Could live in RAM or be

More information

OPERATING SYSTEMS MEMORY MANAGEMENT

OPERATING SYSTEMS MEMORY MANAGEMENT OPERATING SYSTEMS MEMORY MANAGEMENT Jerry Breecher 8: Memory Management 1 OPERATING SYSTEM Memory Management What Is In This Chapter? Just as processes share the CPU, they also share physical memory. This

More information

Understanding Performance Monitoring

Understanding Performance Monitoring CHAPTER 3 Cisco Unified Communications Manager and Cisco Unity Connection directly update Performance counters (called PerfMon counters). The counters contain simple, useful information on the system and

More information

NEC Storage Manager Data Replication User's Manual (Function Guide)

NEC Storage Manager Data Replication User's Manual (Function Guide) NEC Storage Manager Data Replication User's Manual (Function Guide) NEC Corporation 2001-2003 No part of the contents of this book may be reproduced or transmitted in any form without permission of NEC

More information

SAP HANA Memory Usage Explained

SAP HANA Memory Usage Explained SAP HANA Memory Usage Explained Memory is a critical SAP HANA resource. This paper explains the basic memory concepts and how to explore the memory consumption of a SAP HANA system. Chaim.Bendelac@sap.com

More information

Storing Data: Disks and Files. Disks and Files. Why Not Store Everything in Main Memory? Chapter 7

Storing Data: Disks and Files. Disks and Files. Why Not Store Everything in Main Memory? Chapter 7 Storing : Disks and Files Chapter 7 Yea, from the table of my memory I ll wipe away all trivial fond records. -- Shakespeare, Hamlet base Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Disks and

More information