【翻译WINDOWS NT FILE SYSTEM INTERNAL】NT缓存管理器一(4)

本文探讨了NT缓存管理器通过虚拟块缓存(vbc)实现文件数据高效缓存的机制与优势,与物理块寻址缓存数据的传统方法进行对比,阐述了vbc在应用程序访问文件数据时的灵活性与效率提升。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Virtual Block Caching(vbc)

一些操作系统使用物理偏移(或磁盘块地址)实现在系统内存中缓存文件数据。不同于其他使用磁盘块地址的操作系统,NT缓存管理器通过对文件流缓存使用文件映射方法提供虚拟块缓存(vbc)。图6-1描述这两种数据缓存方法之间的不同。值得注意的是,指示逻辑顺序的序号在操作系统中被实现(Note that the numbering indicates the logical sequence in which the operations areperformed.)。

在使用物理块寻址缓存数据的操作系统(UNIX SVR4老式缓冲区缓存实现)中,文件系统或缓存模块必须在检查数据存在于系统缓存中之前,先把虚拟字节偏移转换成一个磁盘上物理块偏移文件,因此,缓存模块—缓冲区缓存—使用物理块编号保持对被缓存数据的跟踪。无论如何,如6-1图示,NT缓存管理器使用文件中虚拟字节偏移来跟踪缓存信息。缓存管理器不需要理解将要被访问的物理块地址。因此,仅当数据不能被从正在被缓存管理器管理的缓存中取得的时候,NT操作系统的文件系统驱动通常将磁盘文件虚拟字节偏移转译为磁盘物理块偏移,如果数据不能被维持。

使用虚拟块缓存的好处(与物理块缓存对比):

一些应用程序可以使用本地NT系统调用来访问文件数据,比如,NtReadFile()或NtWriteFile(),但是其他应用程序同时执行可以把需要读或者写访问所需要的数据映射到自己进程地址空间。使用虚拟块缓存,通过文件映射,然后使用适当的同步机制,使得所有这样的应用程序看到几乎全部当前数据成为可能。

概念上讲,被NT缓存管理器映射的文件数据和被应用程序映射的文件数据没有区别。通过使用文件映射模型,所有物理内存都可用来缓存数据。综上所述,NT虚拟内存管理器来管理物理内存的分配;被分配给缓存管理器的物理内存页数量依赖于系统中其他组件对内存需求量的变化。

I/O管理器经常直接调用缓存管理器,完全绕过文件系统驱动或者网络重定向驱动。在一些案例中,缓存管理器通过一个硬件虚拟寻址来解析访问文件是可能的。这明显比,在系统缓冲区中数据合法检查之前,将虚拟地址转换到物理磁盘地址更高效。



npm ERR! code 1 npm ERR! path D:\work\opscloud4\opscloud4-web-master\node_modules\deasync npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./build.js npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@10.0.1 npm ERR! gyp info using node@18.19.0 | win32 | x64 npm ERR! gyp info find Python using Python version 3.12.3 found at "C:\Users\27145\AppData\Local\Programs\Python\Python312\python.exe" npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details npm ERR! gyp ERR! find VS looking for Visual Studio 2015 npm ERR! gyp ERR! find VS - not found npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 npm ERR! gyp ERR! find VS npm ERR! gyp ERR! find VS ************************************************************** npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload. npm ERR! gyp ERR! find VS For more information consult the documentation at: npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows npm ERR! gyp ERR! find VS ************************************************************** npm ERR! gyp ERR! find VS npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use npm ERR! gyp ERR! stack at VisualStudioFinder.fail (D:\ProgramFile\developTool\nvm\nvm\v18.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:113:11) npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio (D:\ProgramFile\developTool\nvm\nvm\v18.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:69:17) npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:95:5) npm ERR! gyp ERR! stack at async createBuildDir (D:\ProgramFile\developTool\nvm\nvm\v18.19.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:69:26) npm ERR! gyp ERR! stack at async run (D:\ProgramFile\developTool\nvm\nvm\v18.19.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js:81:18) npm ERR! gyp ERR! System Windows_NT 10.0.26100 npm ERR! gyp ERR! command "D:\\ProgramFile\\developTool\\nvm_nodejs\\nodejs\\node.exe" "D:\\ProgramFile\\developTool\\nvm\\nvm\\v18.19.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd D:\work\opscloud4\opscloud4-web-master\node_modules\deasync npm ERR! gyp ERR! node -v v18.19.0 npm ERR! gyp ERR! node-gyp -v v10.0.1 npm ERR! gyp ERR! not ok npm ERR! Build failed
最新发布
06-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值