计算机系 信息处理实验室 Lecture 14 Cache Manager

Slides:



Advertisements
Similar presentations
Windows 2000 I/O System, Cache Manager and File Systems Computing Department, Lancaster University, UK.
Advertisements

Chapter 12: File System Implementation
计算机系 信息处理实验室 Lecture 9 Memory Management(1)
计算机系 信息处理实验室 Lecture 3 System Mechanisms (1)
The Linux Kernel: Memory Management
© Microsoft Corporation1 Windows Kernel Internals Cache Manager David B. Probert, Ph.D. Windows Kernel Development Microsoft Corporation.
计算机系 信息处理实验室 Lecture 10 Memory Management(2)
File Systems.
计算机系 信息处理实验室 Lecture 5 Startup and Shutdown
计算机系 信息处理实验室 Lecture 15 File Systems
计算机系 信息处理实验室 Leture1 concepts and tools 2005 Spring 陈香兰.
计算机系 信息处理实验室 Lecture 8 Processes, Threads, and Jobs (2)
File Systems Examples.
计算机系 信息处理实验室 Lecture 16 Networking
计算机系 信息处理实验室 Lecture 11 Security
Chapter 11: File System Implementation
File System Implementation
File System Implementation CSCI 444/544 Operating Systems Fall 2008.
Recap of Feb 25: Physical Storage Media Issues are speed, cost, reliability Media types: –Primary storage (volatile): Cache, Main Memory –Secondary or.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
1 File Management in Representative Operating Systems.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
OPERATING SYSTEMS Introduction
File System Variations and Software Caching May 19, 2000 Instructor: Gary Kimura.
1/21/2010CSCI 315 Operating Systems Design1 Computer System Structures Notice: The slides for this lecture have been largely based on those accompanying.
1 I/O Management in Representative Operating Systems.
计算机系 信息处理实验室 Lecture 2 System architecture
计算机系 信息处理实验室 Lecture 12 I/O System
File System. NET+OS 6 File System Architecture Design Goals File System Layer Design Storage Services Layer Design RAM Services Layer Design Flash Services.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Storage and NT File System INFO333 – Lecture Mariusz Nowostawski Noria Foukia.
1 File System Implementation Operating Systems Hebrew University Spring 2010.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
计算机系 信息处理实验室 Lecture 7 Processes, Threads, and Jobs (1)
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
Some VM Complications Extra memory accesses Page tables are huge
计算机系 信息处理实验室 Lecture 6 Management Mechanisms
© Microsoft Corporation Windows Kernel Internals II Advanced File Systems University of Tokyo – July 2004 Dave Probert, Ph.D. Advanced Operating.
计算机系 信息处理实验室 Lecture 4 System Mechanisms (2)
UNIX File and Directory Caching How UNIX Optimizes File System Performance and Presents Data to User Processes Using a Virtual File System.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
CS333 Intro to Operating Systems Jonathan Walpole.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
W4118 Operating Systems Instructor: Junfeng Yang.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 3: Windows7 Part 3.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Day 28 File System.
Jonathan Walpole Computer Science Portland State University
Cache Manager Orlando Robertson Brown Bag Seminar
CSI 400/500 Operating Systems Spring 2009
Chapter 11: File System Implementation
So far… Text RO …. printf() RW link printf Linking, loading
Overview Continuation from Monday (File system implementation)
Chapter 8: Memory management
Outline Module 1 and 2 dealt with processes, scheduling and synchronization Next two modules will deal with memory and storage Processes require data to.
Overview: File system implementation (cont)
File-System Structure
CSE451 Virtual Memory Paging Autumn 2002
Lecture 3: Main Memory.
The Design and Implementation of a Log-Structured File System
Presentation transcript:

计算机系 信息处理实验室 Lecture 14 Cache Manager

计算机系 信息处理实验室 the Inside of Windows Cache Manager Key Features of the Windows 2000 Cache Manager Cache Structure Cache Size Cache Data Structures Cache Operation Cache Support Routines

计算机系 信息处理实验室 the Inside of Windows Cache Manager A set of kernel-mode functions and system threads Provide data caching for all 2K FS drivers Both local and network Cooperate with the memory manager Cache the purpose of a cache is to keep a subset of frequently accessed data in physical memory as a way to improve I/O performance

计算机系 信息处理实验室 the Inside of Windows Key Features of 2K Cache Manager Supports all file system types (both local and network) Uses the memory manager to control what parts of what files are in physical memory Caches data on a virtual block basis Supports "hints" passed by applications at file open time (such as random versus sequential access, temporary file creation, and so on) Supports recoverable file systems

计算机系 信息处理实验室 the Inside of Windows Single, Centralized System Cache Some operating systems rely on each individual file system to cache data 2K offers a centralized caching facility caches all externally stored data local hard disks, floppy disks, network file servers, or CD-ROMs user data streams or file system metadata

计算机系 信息处理实验室 the Inside of Windows The memory manager Cache held in virtual (no phys) memory Cache manager can’t tell what’s in phys mem Files mapped by Section Objects Cc copies data to/from Section Object (ref I/O system) MM pages data in and flushes it out Each section logically n * (256-byte) views Maintained until all handles for file x closed

计算机系 信息处理实验室 the Inside of Windows The memory manager Cache manager Memory manager Physical pages Virtual memory

计算机系 信息处理实验室 the Inside of Windows Cache coherency Must ensure that any process accessing cached data will get the most recent version of that data Example: Process 1, open/read/write Process 2, map into its address space

计算机系 信息处理实验室 the Inside of Windows Coherent caching scheme

计算机系 信息处理实验室 the Inside of Windows Virtual Block Caching Logical blocks Keeps track of which blocks of a disk partition are in the cache Novell NetWare, OpenVMS, OS/2, and older UNIX systems Virtual block caching Keeps track of which parts of which files are in the cache

计算机系 信息处理实验室 the Inside of Windows Virtual block caching Benefits Opens up the possibility of doing intelligent read- ahead Allows the I/O system to bypass going to the file system for requests for data that is already in the cache (fast I/O)

计算机系 信息处理实验室 the Inside of Windows Stream-Based Caching Stream caching vs. file caching A stream is a sequence of bytes within a file Some file systems allow a file to contain more than one stream NTFS Stream caching: caching each stream independently

计算机系 信息处理实验室 the Inside of Windows Recoverable File System Support Recoverable file systems Can reconstruct the disk volume structure after a system failure A log file is maintained NTFS

计算机系 信息处理实验室 the Inside of Windows Recoverable File System Support The cache manager and the file system must work together The file system writes a log file record documenting the volume update it intends to make. The file system calls the cache manager to flush the log file record to disk. The file system writes the volume update to the cache; that is, it modifies its cached metadata. The cache manager flushes the altered metadata to disk, updating the volume structure. (Actually, log file records are batched before being flushed to disk, as are volume modifications.)

计算机系 信息处理实验室 the Inside of Windows Cache structure Cache manager caches data on a virtual basis A region of system virtual address spaces is divided into views View: 256KB slots See System cache address space

计算机系 信息处理实验室 the Inside of Windows System cache address space

计算机系 信息处理实验室 the Inside of Windows Round-robin

计算机系 信息处理实验室 the Inside of Windows Cache Size how Windows 2000 computes the size of the system cache ? Cache Virtual Size ? Cache Physical Size ?

计算机系 信息处理实验室 the Inside of Windows Cache Virtual Size Default size : 64 MB If physical memory is more than 16 MB : 128 MB + (64 MB - 16 MB) / 4 MB * PMEM = 896 MB Size and Location of System Data Cache PlatformAddress Range Min/Max Virtual Size x86 2-GB system space 0xC E0FFFFFF, 0xA BFFFFFFF MB x86 1-GB system space0xC DBFFFFFF MB x86 1-GB system space with Terminal Services 0xC DCFFFFFF MB

计算机系 信息处理实验室 the Inside of Windows Cache Physical Size The Windows 2000 Task Manager doesn't report the size of the system cache

计算机系 信息处理实验室 the Inside of Windows Some Confused concepts system cache system cache working set system working set Some System Variables Memory: System Cache Resident Bytes MmSystemCachePage Memory: Cache Bytes MmSystemCacheWs.WorkingSetSize Memory: Cache Bytes Peak MmSystemCacheWs.Peak Memory: Cache Faults/Sec MmSystemCacheWs.PageFaultCount A part

计算机系 信息处理实验室 the Inside of Windows Cache data structure to keep track of cached files A virtual address control block For each 256-KB slot in the system cache A private cache map For each separately opened cached file A single shared cache map structure For mapped views of the cached file

计算机系 信息处理实验室 the Inside of Windows Systemwide Cache Data Structures system cache and virtual address control blocks (VACBs) VACB structure 256KB

计算机系 信息处理实验室 the Inside of Windows Per-File Cache Data Structures File Handle

计算机系 信息处理实验室 the Inside of Windows If read file Is the file in the cache? If so, which VACB, if any, refers to the requested location? VACB index arrays

计算机系 信息处理实验室 the Inside of Windows Cache Operation Write-Back Caching and Lazy Writing Intelligent Read-Ahead

计算机系 信息处理实验室 the Inside of Windows Write-Back Caching and Lazy Writing Data written to files is first stored in memory in cache pages and then written to disk later Flush timing Cache manager  Memory manager Demand for physical memory exceeds supply System thread—the lazy writer Created once per second 1/8 of the dirty pages in the system cache or more to be written to disk

计算机系 信息处理实验室 the Inside of Windows Dirty Page Threshold The number of pages that the system cache keeps in memory before waking up the lazy writer Calculating the Dirty Page Threshold System Memory Size Dirty Page Threshold SmallPhysical pages/8 MediumPhysical pages/4 LargeSum of the above two

计算机系 信息处理实验室 the Inside of Windows Disabling Lazy Writing for a File Win32 CreateFile function Specifies FILE_ATTRIBUTE_TEMPORARY to create a temporary file The lazy writer won't write dirty pages to the disk unless there is a severe shortage of physical memory or the file is closed To improve system performance

计算机系 信息处理实验室 the Inside of Windows Write Through Caching Win32 CreateFile function Specifies FILE_FLAG_WRITE_THROUGH flag Or, Win32 FlushFileBuffers function

计算机系 信息处理实验室 the Inside of Windows Flushing Mapped Files

计算机系 信息处理实验室 the Inside of Windows

计算机系 信息处理实验室 the Inside of Windows

计算机系 信息处理实验室 the Inside of Windows

计算机系 信息处理实验室 the Inside of Windows

计算机系 信息处理实验室 the Inside of Windows Cache support routines

计算机系 信息处理实验室 the Inside of Windows Copying to and from the Cache Kernel-Mode Functions for Copying to and from the Cache CcCopyRead CcFastCopyRead CcCopyWrite CcFastCopyWrite

计算机系 信息处理实验室 the Inside of Windows Mapping and Pinning Functions for Finding Metadata Locations CcMapData CcPinRead CcPreparePinWrite CcPinMappedData CcSetDirtyPinnedData CcUnpinData

计算机系 信息处理实验室 the Inside of Windows DMA Functions That Create the DMA Interface CcMdlRead CcMdlReadComplete CcMdlWrite CcMdlWriteComplete MDL: Memory descriptor list

计算机系 信息处理实验室 the Inside of Windows Write Throttling Write throttling: cache manager’s lazy writer Upgrade system performance for large write operation Useful for network redirectors transmitting data over slow communication line Example: writes a large amount of data to a remote file system over a 9600-baud line