Professional Documents
Culture Documents
ICS 143 - Principles of Operating Systems
ICS 143 - Principles of Operating Systems
Operating Systems
Lectures 14 and 15 - FileSystem Interface and
Implementation
Prof. Nalini Venkatasubramanian
nalini@ics.uci.edu
Outline
File Concept
Types
Data
Program
Documents
File Structure
Complex Structures
Lines
Fixed Length
Variable Length
Formatted document
Relocatable Load File
Operating System
Program
File Attributes
Name
Type
Protection
Size
Location
File Operations
Create a file
Write a file
Read a file
Reposition within file - file seek
Delete a file
Truncate a file
Open(Fi)
search the directory structure on disk for entry Fi, and move the
content of entry to memory.
Close(Fi)
Possible extension
Function
Executable
Exe,com,bin
Object
Obj, o
Source code
Batch
Bat, sh
text
Txt, doc
Machine language
program
Compiled machine lang.,
not linked
Source code in various
languages
Commands to command
interpreter
Textual data, documents
Print, view
archive
Library
Lib, a
Directory Structure
File Name
File Type
Address or Location
Current Length
Maximum Length
Date created, Date last accessed (for archival),
Date last updated (for dump)
Owner ID (who pays), Protection information
Two users can have the same name for different files.
The same file can have several different names.
Grouping
Efficient Searching
Grouping Capability
Current Directory (working directory)
cd /spell/mail/prog
type list
Deletion
Removing file when someone deletes it may leave
dangling pointers.
Preserve file until all references to it are deleted
Access Methods
Sequential Access
read next
write next
reset
no read after last write (rewrite)
Protection
Types of access
read
write
execute
append
delete
list
File-System Implementation
File-System Structure
File Structure
Contiguous Allocation
Linked List Allocation
Block Allocation
Contiguous Allocation
Problems
Contiguous Allocation
Linked Allocation
Linked Allocation
Linked Allocation
Indexed Allocation
Index table
Indexed Allocation
40
Multilevel Index
Index block
link
link
Index block
link
link
data
data
data
Direct blocks
data
data
Single indirect
double indirect
Triple indirect
data
data
data
data
data
45
n-1
bit[i] =
Counting
Need to protect
Solution
Directory Implementation
simple to program
time-consuming to execute - linear search to find entry.
Sorted list helps - allows binary search and decreases search
time.
LRU
Free-behind - removes block from buffer as soon as next block
is requested.
Read-ahead - request block and several subsequent blocks are
read and cached.
Recovery
Backup
Restore