Академический Документы
Профессиональный Документы
Культура Документы
11.2
11.3
11.4
11.5
11.6
Objectives
To explain the function of file systems
To describe the interfaces to file systems
To discuss file-system design tradeoffs, including access methods,
directory structures
11.7
File Concept
11.8
File Concept
Resource for storing information
Contiguous logical address space
User point of view
OS point of view
Files contains
Data
Meta-data - FCB
11.9
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
Program
11.10
11.11
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,
11.12
File Operations
File is an abstract data type
Operations:
Create
Write
Read
Delete
Truncate
11.13
Open Files
Several pieces of data are needed to manage open files:
11.14
Access Methods
11.15
Sequential-access File
11.16
Access Methods
Sequential Access
read next
write next
reset
no read after last write
(rewrite)
Direct Access
read n
write n
position to n
read next
write next
rewrite n
n = relative block number
11.17
11.18
11.19
Directory Structure
11.20
Directory Structure
A collection of nodes containing information about all files
Directory
Files
F1
F2
F3
F4
Fn
11.21
11.22
11.23
11.24
Single-Level Directory
A single directory for all users
Naming problem
Grouping problem
11.25
Two-Level Directory
Separate directory for each user
Path name
Can have the same file name for different user
Efficient searching
No grouping capability
11.26
Tree-Structured Directories
Efficient searching
Grouping capability
11.27
Delete a file
rm <file-name>
Creating a new subdirectory is done in current directory
mkdir <dir-name>
Example: if in current directory /mail
mkdir count
mail
prog
11.28
Acyclic-Graph Directories
Have shared subdirectories and files
11.29
Solutions:
Entry-hold-count solution
11.30
Protection
11.31
Protection
File owner/creator should be able to control:
by whom
Types of access
Read
Write
Execute
Append
Delete
List
11.32
b) group access
c) public access
RWX
111
RWX
110
RWX
001
owner
chmod
group
public
761
game
chgrp
Operating System Concepts
game
11.33
11.34
11.35
11.36
File-System Structure
File structure
about a file
11.37
11.38
11.39
11.40
11.41
11.42
11.43
system.
11.44
11.45
Directory Implementation
Linear list of file names with pointer to the data blocks.
simple to program
time-consuming to execute
fixed size
11.46
Alocation Methods
11.47
Allocation Methods
An allocation method refers to how disk blocks are allocated for
files:
Contiguous allocation
Linked allocation
Indexed allocation
11.48
Contiguous Allocation
Each file occupies a set of contiguous blocks on the disk
Simple only starting location (block #) and length (number
11.49
11.50
Extent-Based Systems
Many newer file systems (I.e. Veritas File System) use a modified
11.51
Linked Allocation
Each file is a linked list of disk blocks: blocks may be scattered
block
pointer
11.52
11.53
Linked Allocation
11.54
File-Allocation Table
MSDOS links pages
11.55
Indexed Allocation
Brings all pointers together into the index block.
Logical view.
index table
11.56
11.57
Random access
Dynamic access without external fragmentation, but have
11.58
outer-index
index table
11.59
file
Pros:
Simple (more or
less)
Files can easily
expand (up to a
point)
Small files
particularly cheap
and easy
Cons:
Lots of seeks
11.60
End of Course 11