ImageVerifierCode 换一换
格式:DOCX , 页数:13 ,大小:71.79KB ,
资源ID:8202781      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8202781.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(A File System for the 21st Century Previewing the Windows NT 50 File System.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

A File System for the 21st Century Previewing the Windows NT 50 File System.docx

1、A File System for the 21st Century Previewing the Windows NT 50 File SystemA File System for the 21st Century: Previewing the Windows NT 5.0 File SystemJeffrey Richter and Luis Felipe CabreraBecause of the way NTFS stores attributes, it is possible for all of the attributes of a single file, includi

2、ng its Data attribute, to be resident. This improves performance when accessing small files. NTFS also stores the most common attributes of a file in the files directory entry.This article assumes youre familiar with C+ and Win32Code for this article: Nov98NTFS.exe (5KB)Jeffrey Richter wrote Advance

3、d Windows, Third Edition (Microsoft Press, 1997) and Windows 95: A Developers Guide (M&T Books, 1995). Jeff can be reached at www.JeffreyR. Luis Felipe Cabrera is an architect in the Windows NT Base Development group at Microsoft. His responsibilities are in Windows NT 5.0 storage management.Many of

4、 your programming tasks will be simplified when you take advantage of the new innovations in the Windows NT 5.0 file system (NTFS). Lets go on a whirlwind tour of these new features. Remember, we are discussing software that is in beta, so everything is subject to change. Please check Microsofts mos

5、t recent documentation before writing any code based on this information. Lets begin with an overview of the NTFS file system layout on disk. While this information is programmatically off-limits to the application developer, a high-level explanation will make it much easier for you to understand ma

6、ny of the new NTFS features. At the heart of the NTFS file system is a special file called the master file table (MFT). This file is created when you format a volume for NTFS. The MFT consists of an array of 1KB entries; each entry identifies a single file on the volume. When you create a file, NTFS

7、 must first locate an empty entry within the MFT array (growing the array if necessary); then it fills the 1KB entry with information about the file. A files information consists of a collection of attributes. Figure 1 shows a list of standard attributes that can be associated with a single file (or

8、 directory). When a file is created, the system creates the set of attributes for the MFTs file entry and attempts to place them inside the 1KB block. But there are two problems: most attributes are variable length, and many attributes (like Name, Data, and Named Data) can be much larger than 1KB. S

9、o NTFS cant just simply throw all the attributes inside an MFT entry. Instead, NTFS must examine the attributes; if the length of an attributes value is small, the attributes value is placed inside the MFT entry. This is called a resident attribute. If the attributes value is large, then the system

10、places the attribute value in another location on the disk (making this a nonresident attribute), and simply places a pointer to the attributes value inside the MFT entry. Today, everybody has lots and lots of small files stored throughout their hard drives. We all have lots of shortcut (.LNK) files

11、 and probably lots of DESKTOP.INI files sprinkled around. Because of the way that NTFS stores attributes in an MFT entry, it is possible for all of the attributes of a single file, including its Data attribute, to be resident. This greatly improves performance when accessing small files. In addition

12、, NTFS also stores the most common attributes of a file in the directory entry that represents the file. This means that when the system does a FindFirstFile/FindNextFile operation to retrieve a files name or basic attributes, the data for these attributes is found in the directory entry, so no othe

13、r disk access is needed. Prior to Windows NT 4.0, an MFT entry in NTFS was 4KB in size. This, of course, allowed files with slightly more data to have their data resident. In Windows NT 4.0, Microsoft pared the size of an MFT entry to 1KB. Microsoft studied the number of files and their sizes on man

14、y typical systems and saw that NTFS was wasting a lot of space in MFT entries and that it would be more efficient to make the MFT entry 1KB. Now lets go over some of the features offered by NTFS that software developers can (and should) take advantage of.StreamsIts little known that NTFS allows a si

15、ngle file to have multiple data streams. This feature has actually been in NTFS since its very first version (in Windows NT 3.1) but has been downplayed by Microsoft. This is unfortunate because streams can be incredibly useful in many situations. For instance, lets say that you are developing a bit

16、map-editor application. When the user saves their data, you create a BMP file on the hard disk. Youd also like to store a thumbnail version of the image as well. Thumbnails are typically stored at the end of a file, after the main bitmap image. To show the thumbnail image, you must open the file, pa

17、rse the header information, seek to the bytes following the main images data, read in the thumbnail images data, and then display the thumbnail. You could store the thumbnail data in a separate file, but its not a good idea because its too easy for the main image file and the thumbnail file to get s

18、eparated. An NTFS named stream offers the best of both worlds. When your application creates its file, you can write the main images data to the default (unnamed) stream and then create another (named) data stream inside the same file for the thumbnail images data. You have only one file, but it con

19、tains two data streams. To understand how this works, lets perform an experiment. On a Windows NT-based machine (any version) open a command shell. Then change to an NTFS partition and enter the following: C:ECHO Hi Reader XX.TXT:MyStreamWhen you execute this command, the system creates a file calle

20、d XX.TXT. This file contains two streams: an unnamed stream that contains 0 bytes and a named stream (called MyStream) that contains the text Hi Reader. If you havent guessed by now, you access a files named stream by placing a colon after the file name followed by the name of the stream. As with fi

21、le names, Win32 functions treat stream names as case-preserved and searches are case- insensitive. Unfortunately, the tools supplied with the system treat streams as second class citizens at best. For example, execute the following command: C:DIR XX.TXT Volume in drive C is Wizard Volume Serial Numb

22、er is 40E5-92D4 Directory of C: 03/18/98 08:36a 0 XX.TXT 1 File(s) 0 bytes 0 Dir(s) 3,399,192,576 bytes freeAs you can see, DIR reports that the file size is 0 bytes, but this is not true. The DIR command only reports to the user the size of a files unnamed stream; the sizes of named streams within

23、the file are not shown to the user. By the way, Explorer also reports a file size of 0 bytes. This allows for some geeky party games where you can allocate a large stream in a file on a friends disk. The friend wont be able to discover where all the disk space has gone because all of the tools repor

24、t that the file occupies only 0 bytes! When working with streams, remember that its only the tools that dont treat streams with the respect that they deserve; NTFS has full support for streams (they even count against your storage quota). Now, to see the contents of the stream, execute this command:

25、 C:MORE XX.TXT:MyStream Hi Reader Heres another way to use streams. Say that you are writing a word-processing application. When the user opens up an existing document, you will probably create a temporary file that holds all of the users changes. Then, when the user decides to save the changes, you

26、 will write all of the updated information to the temporary file, delete the original file, and finally move the temporary file back to the original files location while renaming the file. This sounds fairly simple and straightforward, but youre probably forgetting a few things. The final file shoul

27、d have the same creation timestamp as the original, so youll have to fix that. The final file should also have the same file attributes and security information as the original. It is very easy to miss properly updating some of these attributes during this file-save operation. If you use streams, al

28、l of these problems go away. All streams within a single file share the files attributes (timestamp, security, and so on). You should revise your application so that the users temporary information is written to a named stream within the file. Then, when the user saves the data, rename the temporary

29、 named data stream to the unnamed data stream, and NTFS will delete the old unnamed data stream and do the rename in an all-or-nothing manner. You wont have to do anything to the files attributes at all; theyll all just be the same. Before we leave streams, let us just point out a few more things. F

30、irst, if you copy a file containing streams to a file system that doesnt support streams (like the FAT file system used on floppy disks), only the data in the unnamed stream is copied over; the data in any named streams does not get copied. Second, named data streams can also be associated with a di

31、rectory. Directories never have an unnamed data stream associated with them but they certainly can have named streams. Some of you may be familiar with the DESKTOP.INI file used by the Explorer. If the Explorer sees this file in a directory, it knows to load a shell namespace extension and allows th

32、e shell namespace extension to parse the contents of the directory. The system uses this for folders such as My Documents, Fonts, Internet Channels, and many more. Since the DESKTOP.INI file describes how the Explorer should display the contents of a directory, wouldnt it make more sense for Microsoft to place the DESKTOP.INI data into a named stream within a directory? The reason Microsoft doesnt do this is backward compatibility. Streams are implemented only on NTFS drives; they do not exist on FAT file systems or on CD-ROM drives. For

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1