Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cache Manager Yonghyun Kim Microsoft MVP Dev 5 team leader, ESTsoft

Similar presentations


Presentation on theme: "Cache Manager Yonghyun Kim Microsoft MVP Dev 5 team leader, ESTsoft"— Presentation transcript:

1 Cache Manager Yonghyun Kim Microsoft MVP Dev 5 team leader, ESTsoft
Debuglab Windows Internals study member

2 Cache, Do you think about it?

3 Maybe.. Is it Buffers?

4 Benefits – Virtual Block Basis
OS Side Application Side Virtual Block Basis Raw data each file system Logical Block Basis Photo Data Manager Sound Data Manager Binary Data Manager

5 Benefits – Virtual Block Basis
Cache Block in Memory Manager 256k Random Access Sequential Access Intelligent Read-Ahead File1 256k

6 H E L L O \n Benefits - Fast I/O void GoodFile::readFile() { char c;
FILE* stream = fopen(“data.bin”, “r”); while(1) c = fread(&c, sizeof(char), 1, stream) if(‘\0’ == c) break; }

7 Benefits – Intelligent Read-Ahead
나는 니가 다음에 읽을 데이터를 알고 있다

8 Cache Coherency Both cache manager and map files use the same memory management file mapping service. Process1 Cached File view Cache Manager Memory Management File Mapping Services File block File block File block Process2 Mapped File view File block

9 Windows Cache Manager 모든 파일 시스템 타입들을 지원 메모리 관리자를 이용 가상 블록 기반의 Fast I/O
Stream Based Caching

10 Cache Mechanism Overview
System Cache Virtual Address After 0x Shared Cache map File1 User Mode CcCopyRead HANDLE 0x15 FILE OBJECT NTFS

11 Cache Mechanism Overview
Virtual Address Control Block Kernel Virtual Address Space FOVA File1 256k File1 256k

12 Cache Size – LargeSystemCache
사용자가 선택한 UI 에 따라 LargeSystemCache 값이 바뀜

13 Viewing the Cache Virtual Size

14 Big File Processing with Cache
처리 해야 될 파일이 클 경우 허용되는 물리 메모리가 모두 파일 데이터를 캐시 하는데 쓰임

15 Looking at the Cache’s Working Set

16 Systemwide Cache Data Structures
CcVacbs System VACB Array View System VACB Array System VACB Array View System VACB Array View Virtual Address of Data in system cache Pointer to shared cache map File offset Active count View

17 Per-file cache data structures

18 VACB Index Arrays

19 Multilevel VACB arrays

20 Looking at Shared and Private Cache Maps

21 File system interaction with cache
Virtual Memory Manager Virtual Memory Page Fault 새로운 view mapping 파일 읽기 요청 File System Drvier Cache Manager IRP 요청 Cache Manager 에게 데이터 요청

22 File system interaction with cache
Virtual Memory Manager Virtual Memory 데이터가 들어옴 데이터를 캐시로 가져옴 파일 읽음 File System Drvier Cache Manager 데이터 리턴

23 File Function interaction with cache
Virtual Memory Manager Virtual Memory PageFault MmCreateSection MmFlushSection IoPageRead File System Drvier Cache Manager NtReadFile NtWriteFile CcCopyRead / CcFastCopyRead CcCopyWrite / CcFastCopyWrite

24 Fast I/O Decision tree

25 Intelligent Read-Ahead
Asynchronous Read-Ahead with History CcReadAheadIos 를 통하여 확인 두번 읽기 요청한 파일 핸들을 보관 (private cache map) Sequential Read-Ahead CreateFile에 FILE_FLAG_SEQUENTIAL_SCAN 인자 해당 파일의 비활성 뷰를 해제 두배의 데이터를 미리 읽음(64k -> 128k)

26 Write-Back Caching and Lazy Writing
시스템 작업쓰레드 초당1회 실행 시스템 캐시 내 변경 페이지의 1/8을 씀 Lazy Writing CreateFile에 FILE_ATTRIBUTE_TEMPORARY 인자 물리메모리 부족이나 파일 갱신이 이루어 지지 않으면 디스크에 쓰지 않음 (시스템 성능 향상)

27 Write Through CreateFile에 FILE_FLAG_WRITE_THROUGH FlushFileBuffers
파일 쓰기와 변경작업의 즉시 적용 FlushFileBuffers CcDataFlushes CcDataPages

28 References Windows Internals Windows 구조와 원리 Channel 9 - Cache Manager

29 Thank you


Download ppt "Cache Manager Yonghyun Kim Microsoft MVP Dev 5 team leader, ESTsoft"

Similar presentations


Ads by Google