0% found this document useful (0 votes)
25 views24 pages

File System

The document discusses file systems and file management. It describes the key components of a file including name, size, location and attributes. It outlines common file operations such as create, read, write and delete. It also discusses how files are organized in a hierarchical directory structure and describes different directory organization approaches. Finally, it covers important file system concepts like protection, sharing, mounting and access control lists.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views24 pages

File System

The document discusses file systems and file management. It describes the key components of a file including name, size, location and attributes. It outlines common file operations such as create, read, write and delete. It also discusses how files are organized in a hierarchical directory structure and describes different directory organization approaches. Finally, it covers important file system concepts like protection, sharing, mounting and access control lists.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

File-System Interface

Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne


File Concept
 Contiguous logical address space
 Types:
• Data
Numeric

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

 Several pieces of data are needed to


manage open files:
• Open-file table: tracks open files
• File pointer: pointer to last read/write
location, per process that has the file
open
• File-open count: counter of number of
times a file is open – to allow removal of
data from open-file table when last
processes closes it
• Disk location of the file: cache of data
access information
• Access rights: per-process access
mode information
13.5
Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne
File Types – Name, Extension

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

n = relative block number


 Relative block numbers allow OS to decide where
file should be placed

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

 Both the directory structure and the files reside on disk

Operating System Concepts – 10th Edition 13.14 Silberschatz, Galvin and Gagne
Operations Performed on Directory

 Search for a file


 Create a file
 Delete a file
 List a directory
 Rename a file
 Traverse the file system

Operating System Concepts – 10th Edition 13.15 Silberschatz, Galvin and Gagne
Directory Organization

The directory is organized logically to


obtain

 Efficiency – locating a file quickly


 Naming – convenient to users
• Two users can have same name
for different files
• The same file can have several
different names
 Grouping – logical grouping of files
by properties, (e.g., all Java
programs, all games, …)
Operating System Concepts – 10th Edition 13.16 Silberschatz, Galvin and Gagne
Single-Level Directory

 A single directory for all users

 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

 File owner/creator should be able to


control:
• what can be done
• by whom
 Types of access
• Read
• Write
• Execute
• Append
• Delete
• List

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

You might also like