File-system Interface

Download Report

Transcript File-system Interface

Computer Studies (AL)
File Management
File system interface
Reference

Silberschatz, Galvin, Gagne “Operating
System Concepts 6th edition”, 2003, Wiley
Content






File concept
 Attribute, basic operation, type
Access method
 Sequential, direct
Directory Structure
 Single-level, two-level, tree structure
 Absolute path, relative path
File System Mounting
File Sharing (optional)
File protection
File Concept


A file is a named collection of related
information that is recorded on secondary
storage.
Files are mapped, by OS, onto physical
device.
Three special type of files



Source file is a sequence of subroutines and
functions, each of which is further organized as
declarations followed by executable statements.
An object file is a sequence of bytes organized
into blocks understandable by the system’s linker.
An executable file is a series of code sections that
the loader can bring into memory and execute.
File attributes







Name
Identifier
Type
Location
Size
Protection
Time, date and user identification
File Operations








Create a file
Writing a file
Reading a file
Repositioning within a file
Deleting a file
Truncating a file (erase content, keep its attributes)
Appending a file (add info. To a file.)
Renaming a file
Open-file table




Most of the file operations involve searching the directory for the
entry associated with the named file.
To avoid these searching, many systems require that an open system
call be used before that file is first used actively.
The OS keeps a small table containing information about all open
files.
When a file operation is requested, the file is specified via an index
into this table, so no searching is required. When the file is no longer
actively used, it is closed by the process and the operating system
removes its entry in the open-file table. Information associated to
open file includes:




File pointer
File open count (no. of process)
Disk location of the file
Access right
File type

The system uses the extension to indicate
the type of the file and the type of
operations that can be done on that file



Executable: exe, com, bin
Word processor: doc, rtf
Multimedia: mpeg, mov, rm
File Access method

Sequential access




Information in the file is processed in order, one
record after the order
Usually base on a tape model of a file.
Variable-length record.
Direct access



Read and write records rapidly in no particular order
Base on disc model
Fixed-length record
Directory structure

The file system of computers can be
extensive


1. Disk is split into one or more partition
2. In each partition, there are number of
directories.
Single-level directory: all files are contained in the
same directory.
 Two-level directory: user file directory for user
data, where master file directory contains system
files.

Path

Absolute path begins at the root and
follows a path down to the specified file,
giving the directory names on the path


E.g. root/spell/mail/prt/first
Relative path defines a path from the
current directory

E.g. prt/first
Protection

Types of access (controlled access)






Read
Write
Execute
Append
Delete
List
Access control


Files and directories are associated to an accesscontrol list (ACL)
Three classifications of users in connection with
each file:



Owner: the user who created the file is the owner
Group: A set of users who are sharing the file and
need similar access is a group, or group
Universe: all other users in the system constitute the
universe