
- •3.1 Structure
- •3.1.1 Layers of Software
- •Layers and Process Management
- •Encapsulation and Abstraction
- •Layers of Software
- •3.1.2 The bios: Life at the Bottom
- •The Role of the bios
- •Changing bios Settings
- •3.1.3 Process Control
- •3.2 Device Management and Configuration
- •3.2.1 Interrupt Handling
- •Interrupts
- •Interrupt Priority and Nested Interrupts
- •Traps and Faults
- •3.2.2 Hardware Attributes
- •Installing Drivers
- •Changing a Driver's Configuration
- •3.2.3 Configuration
- •3.3 Resource Sharing
- •3.3.1 Virtual Memory
- •Managing Memory
- •Relocation
- •Virtual Memory
- •3.3.2 File and Printer Sharing
- •Printers
- •3.4 File Systems
- •3.4.1 File Organization
- •Folders
- •Shortcuts
- •File Names and Types
- •3.4.2 File Allocation Table and nt File System
- •Clusters and File Allocation Tables
- •Nt File System
File Names and Types
In the original DOS file system, also used in early versions of Windows, file names were limited to eight uppercase characters plus a three-character extension, separated by a "dot" (a period). (These are sometimes referred to as 8.3 style file names.) The extension specified the type of the file. For example, a shopping list stored as a plain text file might be called SHOPPING.TXT, while a resume created as a Microsoft Word document might be RESUME.DOC. Here is a list of extensions for common file types:
.txt |
Plain text file |
.doc |
Microsoft Word document |
.htm |
HTML (Hypertext Markup Language) document |
.xls |
Microsoft Excel spreadsheet |
.gif |
GIF image (Graphic Interchange Format) |
.jpg |
JPEG image (Joint Photographic Experts Group) |
.wav |
Sound file |
.exe |
Executable file (binary machine code) |
.com |
MS-DOS executable ("command" file) |
.drv |
Driver (for a peripheral device) |
.bat |
Batch (script) file for the DOS command interpreter |
Table 1 File extensions
In newer versions of Windows, file type information is automatically determined from the extension. If you double-click a file with the extension .doc, it will be opened by Microsoft Word, while a file with extension .htm will be opened by your browser (for example, Internet Explorer or Firefox). Newer versions of Windows may actually hide extensions from the user. For example, if you create a Word document called Wedding_Invitation, the actual file name will be Wedding_Invitation.doc, but the icon for the file will be labeled Wedding_Invitation. However, you can tell Windows to show you file extensions. From the View pull-down menu, select Options, go to the View tab, and clear the check box labeled Hide extensions for known file types. Now the icon will say Wedding_Invitation.doc.
If you try to open a file whose extension Windows does not recognize, Windows will display a dialog box listing a number of applications and allow you to choose which one to open the file with. Not all of these applications will actually work; it is up to you to choose an application that is appropriate. If you have no idea what is in a file, opening it with a simple text editor like Notepad will let you see if the file is human-readable.
3.4.2 File Allocation Table and nt File System
Clusters and File Allocation Tables
FAT16
FAT32
NT File System
Clusters and File Allocation Tables
Disks are divided into tracks and sectors. See the figure below.
Figure 1 Tracks and sectors on a disk
Sectors hold a fixed number of bytes, typically 512 bytes. One or more sectors are allocated to store a file. If the file contains only a line or two of text, it will fit into a fraction of one sector. In that case, the remainder of the sector is left unused. The unused portion is called slack space. If the file is large, perhaps tens of millions of bytes in length, it will not fit even on a single track. It will require thousands of sectors spread across multiple tracks (they need not be contiguous tracks). As there are likely to be hundreds or even thousands of files on the disk, and each needs one or more sectors, there is some bookkeeping to do. File systems differ in the details of how they solve the bookkeeping problem, but the basic principles are the same.
Because sectors are small, modern computer systems group them into clusters and read or write an entire cluster at a time. A cluster is the smallest amount of space any file can occupy on a disk. A cluster contains 4, 8, 16, 32, or 64 adjacent sectors (the number must be a power of 2). The choice of cluster size depends on the capacity of the drive—the bigger the drive, the bigger the cluster size. A small portion of the disk is reserved for the File Allocation Table (FAT). For each cluster that is part of a file, the FAT entry gives the number of the next cluster for that file. In this way, the clusters that make up a file are chained together, so if you know the address in the FAT of the first cluster of a file, you can find all the others by following the chain. The FAT entry for the last cluster in the chain contains a special marker to indicate that it is the end of the chain.
FAT16
In early versions of the Windows operating system and in MS-DOS, which preceded Windows, the FAT used 16 bits (two bytes) per entry, which allowed for a total of 216 or 65,536 clusters. This scheme is now referred to as FAT16. As hard disk drives got larger, a problem developed— the FAT was too small to accommodate all the available clusters and only allowed for partitions up to 2GB. The following calculation shows how the partition limit of 2GB is derived: 512 (29) bytes per sector * 64 (26) sectors per cluster * 216 clusters in a FAT 16 partition = 231 bytes = 2GB). In addition, small files on a large-cluster file system contain more slack space, wasting space on the disk that could be used to store additional files. For example, there are many files that are 1000 bytes or less, but a 2GB FAT16 partition will reserve 32KB of disk space for each one of those files: 512 (29) bytes per sector * 64 (26) sectors in a cluster = 32768 (215) bytes = 32KB.
One solution to using FAT16 on hard disk drives that contain more than 2GB is to partition the drive into several logical drives—such as drive C, D, and E—each with its own FAT. This works, but it forces users to spread their files across several logical drives when they may not want to organize things that way. Also, if one logical drive completely fills up, no file on that logical drive can grow any larger, even if there is plenty of slack space elsewhere on the disk. Finally, some applications that require huge files, such as database systems, may find that even an entire FAT16 partition is not enough space for one file, although the disk as a whole has enough room.
FAT32
To address these problems, Windows 9x/2000/XP support a FAT32 file system. In this system, 32 bits (4 bytes) are used per entry, but the first 4 bits are reserved. Therefore, it has a total of 2(32-4) = 228 = 268435456 clusters. In a FAT32 file system, smaller clusters can be used instead of larger FAT16 clusters. This leads to more efficient space allocation on the FAT32 drive. The FAT32 can support drives up to two terabytes in size.