File Management: The Architecture of Computer Hardware and Systems Software
File Management: The Architecture of Computer Hardware and Systems Software
File Management
The Architecture of Computer Hardware and Systems Software:
An Information Technology Approach 3rd Edition, Irv Englander John Wiley and Sons 2003
Wilson Wong, Bentley College Linda Senne, Bentley College
Introduction to Files
Files
Collection of data Require a one block minimum Associations to programs
Logical view vs. Physical view Sequential vs. Random access Contiguous vs. Non-contiguous
Chapter 16 File Management 16-2
16-3
16-4
16-5
16-6
16-7
16-8
16-9
File Operations
File as a whole
Copy, Move List, Print Load and execute a program Load file into memory Store file from memory Append data from memory to file Compile, assemble a file
16-10
File Operations
Within a file
Open a file Read a number of bytes from file Write a number of bytes to a file Move the file pointer forward or backward Move file pointer to beginning of a file Close a file
16-11
File Operations
Record Storage
Retrieve a record (read) Store a record (write) Add a record to a file Delete a record Modify contents of a record
16-12
16-13
Random Access
Assumes file is made up of fixed length logical records Hashing is a common method used to calculate the location of an internal logical record
Indexed Access
Additional means for accessing and viewing records in a file Key indexes
16-14
Examples
DOS/Windows FAT UNIX i-nodes Windows NTFS Free space management
16-15
16-17
Linked Allocation
Non-contiguous Each block contains a link to the next physical block Variant links in both directions Advantages
no fragmentation Adding to a file is easy
Disadvantages
Not usable for random access Additional disk head searching Overhead in storing the pointers Recovery of a defective block is difficult
16-18
Linked Allocation
16-19
MS-DOS FAT
File Allocation Table (FAT) Table contains the first block of each file on the disk or disk partition Successive blocks contain a link to the next block Requires a tremendous amount of space File integrity can be easily compromised
Chapter 16 File Management 16-20
MS-DOS FAT
16-21
Indexed Allocation
Non-contiguous All link pointers are stored together in a single block called the index block One index block per file Advantages
No fragmentation Can be used for random access
Disadvantage
Slower due to additional access of the index block Additional disk head searching Recovery of a defective block is difficult
Chapter 16 File Management 16-22
Indexed Allocation
Index blocks for indexed allocation of linked files shown in MS-DOS FAT example
Chapter 16 File Management 16-23
Unix i-nodes
Indexed file allocation Index block contains
File attributes 10 direct blocks 1 single indirect 1 double indirect 1 triple indirect
Advantages
Fast for small blocks Can accommodate very large files 100s of gigabytes
Chapter 16 File Management 16-24
Unix i-nodes
16-25
16-26
16-27
Directory Structure
Provides a means of organization so that files can be located easily and efficiently Hide the physical devices from the logical view of the files Partitions
Independent subsections of a device
Volume
Directory structure for a particular partition Needs to be mounted to be incorporated into the overall file system structure
Tree-Structure Directory
Hierarchical with a top-level root directory from which all other directories stem All directories and files have names Separator
Used to indicate subdirectories and files located in a directory / UNIX \ DOS, Windows
Pathname
Absolute full pathname starting from the root directory Relative pathname is created starting from the current directory
Search Paths
Directory locations that the operating system uses to locate files
16-31
Tree-Structure Directory
16-32
Disadvantages
Cycles and dangling links
Examples
Windows shortcuts Unix hard and symbolic links MacIntosh aliases
Chapter 16 File Management 16-33
An Acyclic-Graph Directory
16-34
Cycle
16-35
16-36
UNIX
16-38
File Protection
Passwords Read, write, and execute protections ACL access control list, permissions UNIX owner, group, everyone DAC discretionary access control
16-39
ls lF
list files in directory using a long format and indicate file type
10-char code for file protection 1st char d for directory, - for file, s for symbolic link r w x read permission write permission execute permission
16-40
16-41