File System
File System
File System
Character
Binary
• Program
Contents defined by file’s creator
• Many types
Consider text file, source file, executable
file
Operating System Concepts – 10th Edition 13.2 Silberschatz, Galvin and Gagne
File Attributes
Name – only information kept in human-
readable form
Identifier – unique tag (number) identifies
file within file system
Type – needed for systems that support
different types
Location – pointer to file location on device
Size – current file size
Protection – controls who can do reading,
writing, executing
Time, date, and user identification – data
for protection, security, and usage
monitoring
Operating System Concepts – 10th Edition 13.3 Silberschatz, Galvin and Gagne
File Operations
Create
Write – at write pointer location
Read – at read pointer location
Reposition within file - seek
Delete
Truncate
Open (Fi) – search the directory
structure on disk for entry Fi, and move
the content of entry to memory
Close (Fi) – move the content of entry Fi
in memory to directory structure on
disk
Operating System Concepts – 10th Edition 13.4 Silberschatz, Galvin and Gagne
Open Files
Operating System Concepts – 10th Edition 13.6 Silberschatz, Galvin and Gagne
File Structure
None - sequence of words, bytes
Simple record structure
• Lines
• Fixed length
• Variable length
Complex Structures
• Formatted document
• Relocatable load file
Can simulate last two with first
method by inserting appropriate
control characters
Who decides:
• Operating system
• Program
Operating System Concepts – 10th Edition 13.7 Silberschatz, Galvin and Gagne
Access Methods
Sequential Access
Direct Access
Operating System Concepts – 10th Edition 13.8 Silberschatz, Galvin and Gagne
Sequential Access
Operations
• read next
• write next
• Reset
• no read after last write (rewrite)
Figure
Operating System Concepts – 10th Edition 13.9 Silberschatz, Galvin and Gagne
Direct Access
A file is fixed length logical records
Operations
• read n
• write n
• position to n
read next
write next
rewrite n
Operating System Concepts – 10th Edition 13.10 Silberschatz, Galvin and Gagne
Simulation of Sequential Access on Direct-access File
Operating System Concepts – 10th Edition 13.11 Silberschatz, Galvin and Gagne
Example of Index and Relative Files
Operating System Concepts – 10th Edition 13.12 Silberschatz, Galvin and Gagne
A Typical File-system Organization
Operating System Concepts – 10th Edition 13.13 Silberschatz, Galvin and Gagne
Directory Structure
A collection of nodes containing information about all files
Operating System Concepts – 10th Edition 13.14 Silberschatz, Galvin and Gagne
Operations Performed on Directory
Operating System Concepts – 10th Edition 13.15 Silberschatz, Galvin and Gagne
Directory Organization
Naming problem
Grouping problem
Operating System Concepts – 10th Edition 13.17 Silberschatz, Galvin and Gagne
Two-Level Directory
Separate directory for each user
Path name
Can have the same file name for different user
Efficient searching
No grouping capability
Operating System Concepts – 10th Edition 13.18 Silberschatz, Galvin and Gagne
Tree-Structured Directories
Operating System Concepts – 10th Edition 13.19 Silberschatz, Galvin and Gagne
File System Mounting
A file system must be mounted before it can be accessed
Fig (a) is a mounted file system that can be accessed by
users.
Fig. (b) is an unmounted files system that cannot be
accessed by users
Operating System Concepts – 10th Edition 13.20 Silberschatz, Galvin and Gagne
Mount Point
Mounting (b) over “users” results in
Operating System Concepts – 10th Edition 13.21 Silberschatz, Galvin and Gagne
File Sharing
Sharing of files on multi-user systems is desirable
Sharing may be done through a protection scheme
On distributed systems, files may be shared across
a network
Network File System (NFS) is a common
distributed file-sharing method
If multi-user system
• User IDs identify users, allowing permissions and
protections to be per-user
Group IDs allow users to be in groups, permitting
group access rights
• Owner of a file / directory
• Group of a file / directory
Operating System Concepts – 10th Edition 13.22 Silberschatz, Galvin and Gagne
Protection
Operating System Concepts – 10th Edition 13.23 Silberschatz, Galvin and Gagne
Windows 7 Access-Control List Management
Operating System Concepts – 10th Edition 13.24 Silberschatz, Galvin and Gagne