Module 4.0: File Systems: K. Salah
Module 4.0: File Systems: K. Salah
Module 4.0: File Systems: K. Salah
0: File Systems
File is a contiguous logical address space (of related records)
Access Methods
Directory Structure
Protection
File System implementation
File-system structure
Allocation Methods
Free-space Management
Directory Implementation
Recovery, Efficiency, and Performance
Operating Systems
File Attributes
Operating Systems
File Operations
create
write
read
reposition within file file seek
delete
truncate
open(Fi) search the directory structure/descriptor on disk for
entry Fi, and move the content of entry to memory.
Operating Systems
Usual extension
Function
Operating Systems
Operating Systems
Access Methods
Sequential Access Tape Model. Reading records in order.
read next
write next
reset
Direct or Random Access Disk Model. Reading records in order and out of order.
read n
write n
position to n
read next
write next
Operating Systems
Memory-Mapped Files
Some OS provides map and unmap system calls.
map will map the file into the address space at the virtual
address. System calls like open, read, seek are not applicable.
Operating Systems
Directory Structure
Directory
Files
F1
F2
F3
F4
Fn
Operating Systems
Name
Type
Address
Current length
Maximum length
Date last accessed (for archival)
Date last updated (for dump)
Owner ID (who pays)
Protection information (discuss later)
Operating Systems
10
Operating Systems
11
Operating Systems
Directory structure:
Single-level: A single directory of all users
Two-level: Separate directory for each user
Tree-structured: Most common
12
Operating Systems
Tree-Structured Directories
Efficient searching
Grouping Capability
Absolute or relative path name
Current directory (working
directory)
cd /spell/mail/prog
type list
Deleting mail deleting the
entire subtree rooted by mail.
13
Operating Systems
Shared Files/Directories
Hard link
The file/directory points to the same file/directory-structure or I-node
of the other file/directory.
e.g., ln /etc/classes/ics431/class hardclass
No i-node is created. Only entry in the i-node of directory which
hardclass is under
Faster for lookup
Has an owner issue
Need to keep a count in the structure for file deletion
14
Operating Systems
Protection
Types of access
Read
Write
Execute
Append
Delete
List
15
Operating Systems
b) groups access
c) public access
RWX
111
RWX
110
RWX
001
chmod
group
761
public
game
G
16
game
Operating Systems
File-System Implementation
Contiguous Allocation
Linked Allocation
Indexed Allocation
17
Operating Systems
Linked Allocation
Each file is a linked list of disk
Free-space management
No random access
File-allocation table (FAT)
18
Operating Systems
Indexed Allocation
Brings all pointers
Random access
Dynamic allocation
without external
fragmentation, but have
overhead of index block.
19
Operating Systems
20
Operating Systems
21
Operating Systems
Directory Implementation
Linear list of file names with pointer to the data blocks.
simple to program
time-consuming to execute
22
Operating Systems
Performance
disk cache separate section of main memory for frequently
used blocks
free-behind and read-ahead techniques to optimize
sequential access
improve PC performance by dedicating section of memory
as virtual disk, or RAM disk.
23
Operating Systems
Operating Systems