Introduction To File Organization
Introduction To File Organization
Introduction to File
Systems
Introduction to File
Systems
Fundamental ambiguity
Is the file the container of the information
or the information itself?
Almost all systems confuse the two.
Almost all people confuse the two.
Introduction to File
Systems
Unix/Linux
By default, time-stamps not preserved on copy, ftp, e-mail, etc.
Time-stamp associated with container, not with information
Introduction to File
Systems
Rule of Thumb
Almost always, people and applications
think in terms of the information
Many systems think in terms of containers
Professional Guidance: Be aware of the
distinction, even when the system is not
CS-4513 D-term 2008
Introduction to File
Systems
Attributes of Files
Name:
Size:
Type:
Protection:
Dates:
Creation, updated, last
accessed, etc.
(Usually) associated with
container
Better if associated with
content
CS-4513 D-term 2008
Locks:
For managing concurrent
access
Introduction to File
Systems
Introduction to File
Systems
Introduction to File
Systems
Example Location
Example 1:
mv ~lauer/project1.doc ~cs4513/public_html/d08
Example 2:
System moves file from disk block 10,000 to disk block
20,000
System restores a file from backup
Introduction to File
Systems
10
Introduction to File
Systems
11
File Types
Introduction to File
Systems
12
Operations on Files
Open, Close
Gain or relinquish access to a file
OS returns a file handle an internal data structure letting it
cache internal information needed for efficient file access
Seek, Tell
Seek: reposition file pointer for subsequent reads and writes
Tell: get current file pointer
Create, Delete:
Conjure up a new file; or blow away an existing one
CS-4513 D-term 2008
Introduction to File
Systems
13
Streams
Input, output, keyboard, display
Pipes, network connections,
Introduction to File
Systems
14
Introduction to File
Systems
15
Introduction to File
Systems
16
Introduction to File
Systems
17
Introduction to File
Systems
18
Questions?
Introduction to File
Systems
19
Introduction to File
Systems
20
Directory structures
Single level
One directory per system, one entry pointing to each file
Small, single-user or single-use systems
PDA, cell phone, etc.
Two-level
Single master directory per system
Each entry points to one single-level directory per user
Uncommon in modern operating systems
Hierarchical
Any directory entry may point to
Individual file
Another directory
Introduction to File
Systems
21
Directory Considerations
Efficiency locating a file quickly.
Naming convenient to users.
Separate users can use same name for separate files.
The same file can have different names for different
users.
Names need only be unique within a directory
Introduction to File
Systems
22
Introduction to File
Systems
23
Links
Symbolic (soft) links: uni-directional relationship between
a file name and the file
Directory entry contains text describing absolute or relative path
name of original file
If the source file is deleted, the link exists but pointer is invalid
Introduction to File
Systems
24
Introduction to File
Systems
25
CS-4513 D-term 2008
Introduction to File
Systems
26
Introduction to File
Systems
27
Directory Operations
Create:
Make a new directory
Find, List:
Search or enumerate directory entries
Rename:
Change name of an entry without changing anything else about it
Link, Unlink:
Add or remove entry pointing to another entry elsewhere
Introduces possibility of loops in directory graph
Destroy:
Removes directory; must be empty
CS-4513 D-term 2008
Introduction to File
Systems
28
Directories (continued)
Orphan: a file not named in any directory
Cannot be opened by any application (or even OS)
May not even have name!
Tools
FSCK check & repair file system, find orphans
Delete_on_close attribute (in metadata)
Introduction to File
Systems
29
Directories Summary
Fundamental mechanism for interpreting
file names in an operating system
Widely used by system, applications, and
users
Introduction to File
Systems
30