© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Default 3 GB user space 2 GB Per-Process Space 2 GB System Space 3 GB Per-Process Space 1 GB System Space.
Background Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for execution. Logical.
Paging: Design Issues. Readings r Silbershatz et al: ,
Virtual Memory Operating System Concepts chapter 9 CS 355
© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Competing For Memory Vivek Pai / Kai Li Princeton University.
Memory Management (continued) May 8, 2000 Instructor: Gary Kimura.
© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Slide 12-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter Virtual Memory.
SQL Server memory architecture and debugging memory Issues
 Demand Technology Software, Inc. Memory Leaks Demand Technology 1020 Eighth Avenue South, Suite 6, Naples, FL phone: (941) fax: (941)
Oracle Memory Configuration on Windows Server Configuring Large Memory for Oracle on 32-bit and 64-bit Windows.
WCL406 Default 3 GB user space 2 GB Per-Process Space 2 GB System Space 3 GB Per-Process Space 1 GB System Space.
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
By Matthew Smith, John Allred, Chris Fulton. Requirements Relocation Protection Sharing Logical Organization Physical Organization.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 11 Case Study 2: Windows Vista Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
 Demand Technology Software, Inc. 32-bit Virtual Memory Constraints in Windows: an Update Mark Friedman Demand Technology 1020 Eighth Avenue South,
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS3: Concurrency 3.5. Lab Slides & Lab Manual.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
Ch 6. Performance Rating Windows 7 adjusts itself to match the ability of the hardware –Aero Theme v. Windows Basic –Gaming features –TV recording –Video.
®® Microsoft Windows 7 for Power Users Tutorial 9 Evaluating System Performance.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel.
Pushing the Limits of Windows
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS5: Memory Management 5.5. Lab Manual.
Windows Memory Architecture 井民全製作. A Process ’ s Virtual Address Space Every Process has its own private virtual address 32-bits processes  4 GB address.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS5: Memory Management 5.4. Physical Memory Management.
Unit OS8: File System 8.6. Lab Manual. 2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows Operating.
Unit OS11: Performance Evaluation Lab Manual.
Unit OS A: Windows Networking A.4. Lab Manual. 2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 10: Virtual Memory Background Demand Paging Page Replacement Allocation of.
Virtual Memory. Background Virtual memory is a technique that allows execution of processes that may not be completely in the physical memory. Virtual.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 9: Virtual Memory.
Computer Systems Week 14: Memory Management Amanda Oddie.
Windows XP & Vista Memory Management
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Processes and Virtual Memory
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS7: Security 7.4. Lab Manual.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS3: Concurrency 3.3. Advanced Windows Synchronization.
Windows XP Memory Management Aaron Lanoy and Jason Farnsworth.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
1 Contents Memory types & memory hierarchy Virtual memory (VM) Page replacement algorithms in case of VM.
A+ Guide to Managing and Maintaining Your PC, 7e Chapter 2 Introducing Operating Systems.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS5: Memory Management 5.3. Virtual Address Translation.
Unit OS5: Memory Management
Mysteries of Windows Memory Management Revealed
Hardware and OS Design and Layout.
Unit OS7: Security 7.4. Quiz Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze.
Unit OSC: Interoperability
Unit OS9: Real-Time and Embedded Systems
Unit OS4: Scheduling and Dispatch
Unit OS11: Performance Evaluation
Unit OS8: File System 8.6. Quiz
Unit OS2: Operating System Principles
Unit OS10: Fault Tolerance
Unit OSB: Comparing the Linux and Windows Kernels
Windows Internals Brown-Bag Seminar Chapter 1 – Concepts and Tools
Chapter 9: Virtual Memory
Unit OS5: Memory Management
CSE451 Virtual Memory Paging Autumn 2002
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Chapter 1: Introduction CSS503 Systems Programming
Michael Blinn Ben Hejl Jane McHugh Matthew VanMater
Presentation transcript:

© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei Operating Systems Memory Management in Windows

Operating systems Copyright Notice  These materials are part of the Windows Operating System Internals Curriculum Development Kit, developed by David A. Solomon and Mark E. Russinovich with Andreas Polze  Microsoft has licensed these materials from David Solomon Expert Seminars, Inc. for distribution to academic organizations solely for use in academic environments (and not for commercial use)   © David A. Solomon and Mark Russinovich

Operating systems Question How much free memory do I have right now?

Operating systems Basics of memory management in Windows  Virtual memory − Hiding physical memory, paging...  Efficiency − demand driven paging − memory sharing, copy-on-write − file caching in memory (section object)  Security − separate address space for every process − accessing through handles (access token)

Operating systems Maximal physical memory (GB) x86 x64 64-bit IA bit Vista Basic 48n/a Vista Business 4128n/a Server 2008 Standard 432n/a Server 2008 Enterprise n/a Itanium n/a 2048 max 4 GB can be handled on 32 bit Physical Address Extension (PAE) 36 address bit: CPU + OS support 64 bit: much larger memory Itanium: Intel server arch., not so popular

Operating systems 32-bit x86 address space 2 GB for user process 2 GB system space 2 GB system space 3 GB for user process 1 GB system 1 GB system Default /3GB switch

Operating systems 64-bit address space  64-bit = 17,179,869,184 GB − x64 currently supports 48 address bit = 262,144 GB 8192 GB (8 TB) for user process 6657 GB system space 6657 GB system space x64

Operating systems User address space : − The running application (.EXE and.DLLs) − User space stack for every thread − Data structures of the application Accessible from user mode Accessible from user mode Accessible only from kernel mode Accessible only from kernel mode } } Unique for every process Common for the whole system FFFFFFF FFFFFFFF Virtual Address Space (V.A.S.)

Operating systems Accessible from user mode Accessible from user mode Accessible only from kernel mode Accessible only from kernel mode } } Unique for every process Common for the whole system FFFFFFF FFFFFFFF Virtual Address Space (V.A.S.) System space: − Executive, kernel and HAL − System level data structures − Page tables (virtual → physical mapping, different for processes) − Executive heaps (pools) − Kernel mode device drivers (in the nonpaged pool) − File system cache − Kernel mode stack for every processes’ every thread

Operating systems Address Space Load Randomization  Change in Vista  Security goal  System EXEs and DLLs are loaded at a random location

Operating systems Memory allocation  Two steps  Reserve: reserving virtual address space  Commit: allocating the virtual memory  Only commits what is really needed

Operating systems 12 Shared memory FFFFFFF User mode v.a.s. User mode v.a.s. User mode v.a.s. User mode v.a.s. Process 1Process 2 Physical memory  E.g. multiple processes use the same file Disk

Operating systems Working Set  Working Set: − Physical memory pages belonging to a process − Can be accessed without a page fault  Working set limit: − Maximal physical memory a process can have − If reached, should switch pages: ● NT 4.0: modified FIFO algorithm ● Windows 2000: Least Recently Used (UP systems) − If free memory falls under a limit: trimming 13

Operating systems 14 Lifecycle of physical pages Standby Page List Zero Page List Free Page List Process Working Sets page read from disk or kernel allocations demand zero page faults working set replacement Modified Page List modified page writer zero page thread “soft” page faults Bad Page List Private pages at process exit

Operating systems Page file  What? − Only modified data, not the code  When? − Also if there is free memory − Processes cannot use as much physical memory as they like − Reservation for new processes  One page file for each partition − Recommended: not on the system drive − But create a small one for the crash dump file  Recommended size − 1,5 times physical memory (?), Fixed size (?) 15

Operating systems DEMO  Changing the size of the page file − GUI − regedit  Perfmon: Page file utilization (%)  Sysinternals: pagedfrg.exe Page file

Operating systems Memory usage Simple question: How much memory does a process consume and for what?

Operating systems Process memory usage - 0  Task manager  Update speed

Operating systems Process memory usage Memory - Working Set shared pages also Memory – Private Working Set without shared pages 2 Memory – Commit size private virtual memory this goes to the page file 3 3

Operating systems Process memory usage - 2  Process Explorer: − Details in the process property  Virtual Memory  Physical Memory

Operating systems DEMO  Sysinternals VMmap Process memory usage

Operating systems System memory usage 1 All committed virtual memory This should go to the page file, does not mean it is currently in the page file 2 Commit limit: physical memory + actual size of the page files ~ Active memory pages 4 4 Standby list

Operating systems Demo Resource monitor

Operating systems Optimalization: Prefetch (Windows XP)  Many page fault at the start of the application  Always the same pages are needed  Prefetch: watching the first 10 seconds  Prefetch “trace file”: \Windows\Prefetch − Name:.EXE-.pf  On next startup − Needed pages are loaded asynchronously  Watching the boot sequence also

Operating systems Another: Superfetch (Vista)  8 priorities to the memory pages − 8 standby list for each priority  Monitoring the usage of pages  After memory deallocations pages are slowly moved back to the standby list

Operating systems  Process Monitor: files used at application startup  Prefetch files − C:\Windows\Prefetch  Layout.ini  Content of a prefetch file: − strings.exe Prefetch

Operating systems Summary  Virtual memory, paging  Multiple optimalization  Analysing memory usage − Task manager: quick summary − Process Explorer, Meminfo: details

Operating systems To read  Windows XP Kernel Improvements: Prefetch Windows XP Kernel Improvements  Inside the Windows Vista Kernel: Inside the Windows Vista Kernel − 1. part: Multimedia Class Scheduler − 2. part: Superfetch, Ready*  XP Myths: Prefetch and other misconceptions XP Myths  MemInfo: Peer Inside Memory Manager Behavior on Windows Vista and Server 2008 MemInfo