Title: File System
1File System
- Most visible aspect of any Operating System to
the User ( Users interact most frequently). - Provides the following facilities
- Mechanism for permanent / non volatile storage of
information in various secondary medias. - Presents an uniform logical view of all these
storage medias to the user O.S.
2Stored Information
- Programs
- User Programs Source, Object , Executable.
- System Programs Packages Executable.
- Data
- a) Text.
- b) Documents.
- c) Multi Media.
3Storage Medias (Filing Cabinets)
- Magnetic Tape Sequential Access.
- Disks
- 1. Magnetic Hard Disk (Direct Access
Outer to Inner - R/W Head floats inside an air
cushion on the Disk surface). - 2. Winchester Disk ( Hermitically
Sealed Magnetic Hard - Disk ).
- 3. Floppy Disk (Flexible magnetic
Disk R/W Head - comes into direct contact with
Disk surface). - 4. Optical Disks (CD_ROM,
DVD_ROM,DVD_RAM, - WORM ) Hard Disks, R/W Head
LASER Beam , - Direct Access Inner to Outer.
- Pen Drive Electrically Alterable ROMs.
4File System (Key Features)
- Collection of Files stored on secondary medias.
File A named collection of related
information (Records) . - A directory structure helps in the following
- - File Organization.
- - Access Rights (Protection
Mechanism) . - One or more Partitions ( Provides separation of
directories useful for better manageability of
large filing cabinet. ) - Implementation (Mapping from Logical viewpoint
to Physical Media) . -
-
5File System Vs. Virtual Memory
- Virtual Memory helps to support a very large
address space in executable memory to a
particular process. File system is a global
feature of managing the Filing Cabinets
(Secondary Media). - File Management predates virtual memory by
several years. - Files stored in secondary media is accessible
even outside the relevant process provided proper
access rights are allowed. - Modern O.S. employ both virtual memory (paging )
as well as file systems as separate interfaces to
secondary memory where pages (virtual memory)
being prevalent together with Disk Swap space
within the realms of process memory management
whereas all files are treated as a separate
resource (Back Up Store). - However the same architectural interface and
technology employed to support File Systems are
used to support Virtual Memory as well.
6A typical File Descriptor
- Name/External Name A string of alphanumeric
characters understood by the user (Human readable
form). - Identifier An unique tag, a number helps to
identify the file in a file system used by the
O.S. (non human accessible). - Type Helps to identify the area of use of the
file (To be illustrated later) (Human readable
form). - Size/Length in bytes /Blocks . Maximum allowed
size is specified sometimes (Human readable
form). - Protection Accessibility Control Based on
user Group (Partly Human readable form). - Owner Identification Related to user id.
(Human readable form). - Time Date (Human readable form) constitutes
of one or more of the following - - File Creation Date Time.
- - Last modification Date Time.
- - Last access Date Time.
- Location Pointer to the start (sometimes also
the Last) physical block of the file as stored on
the secondary media (Non Human accessible but
O.S. readable). - State Open / Closed.
- Sharing Attribute
- Storage Device Details System accessibility.
- N.B
- Any Directory is also a File.
- Each File is also a structured Abstract Data
Type (ADT).
7Basic File Operations
- Creation of a new File CREATE FILE.
- Deletion of an Existing File DELETE FILE.
- Opening an Existing File OPEN FILE.
- All types of file element (Record) accesses
(to be illustrated shortly) must be preceded by
OPEN FILE. This is necessary for activating the
file access mechanism. - Closing an Opened File CLOSE FILE. (After all
references / accesses to that file are finished).
8File Operations - 1 (Tasks at hand)
- A. CREATE FILE
- Allocate space for the File in the designated
media (if space exists). - After allocating space, create a directory entry
with all relevant information. (File is still
empty i.e. does not contain any record). - B.DELETE FILE
- Locate the File Blocks in the media as well as
check whether the file is closed or not. - Release all spaces occupied by that File in the
designated media . - After freeing space, remove the directory entry
for that file.
9File Operations - 2 (Tasks at hand)
- C. OPEN an Existing FILE (Salient Features)
- Activates the File Access Mechanism.
- Helps to eliminate repeated searching of the
file in the directory. - Several Processes may Open the Same File.
- Associated Data Structures
-
P 1
Process Open File Table
P 2
System Open File Table
Secondary Store
10Informations associated with an Open File
- Access Rights Obtained from the directory
matched with Access Requesting Process Id . Used
to regulate the file accessibility from each of
the requesting processes. Contained in the
System File Table. - Start Pointer Address of the starting block of
the File on Secondary Media. Contained in the
System File Table. - Current File Position Pointer Unique to each
Reader processes accessing the file contained in
the Process File Table.. Assuming a single file
writer process and no other access during
writing. - Open Count Non zero Integer counter indicating
number of processes currently accessing the file.
Contained in the Process File Table as well as a
part of the System File Table. Each open call by
a process of a particular file increments this
counter. - Current Access Date Directory entry used
updated by the System File Table. - File Size Directory entry used updated by the
System File Table.
11File Operations 3(File Element / Record Access)
- Read (Reading a record) from the current file
pointer position. - Write (Writing a record) after/at the current
file pointer position. - N.B There may be two(2) separate file pointers
namely a Read Pointer and a Write Pointer
associated with any opened file. - Append Add a new record AFTER the last record of
the file. - Reposition the Current File Pointer (Read/Write)
Dictated by the File Organization as well as
access mechanism as supported by the O.S.
/Storage Media. - Close (File) Inverse of OPEN File.
12Type of a File (The type extension)
- File type associated with the file name itself
in the following manner - ltFile Name gt.ltExtension) File Type Specifier
Stringgt - ? Wild Card (ALL Types that share the same
name)
13File Types (Usage associated access)
- File Type used Extension Usage
Accesibility - --------------------------------------------------
------------- - Document doc, tex, pdf, ps Typed
Documents Direct - --------------------------------------------------
--------------------------------------- - Source c , c, asm , java
Program Source Direct - -------------------------------------------------
--------------------------------------- - archive arc, tar, zip
Related files in Direct / Seq -
Grouped , Compressed - --------------------------------------------------
---------------------------------------- - Library lib , dll
Support Routines Direct - --------------------------------------------------
---------------------------------------- - Data Text txt, dat
Textual Data Direct / Seq. - --------------------------------------------------
------------------------------------------ - Multimedia mpeg, avi, jpeg Binary
File containing Direct -
Audio Video , Picture - --------------------------------------------------
------------------------------------------- - Executable exe, com, bin
Executable Module Direct / Seq. - --------------------------------------------------
-------------------------------------------- - Batch bat , sh
Sequence of Commands Seq Preferable
14File Organization Criteria
- Access time of File Elements / Logical Records
(The faster the better). - Ease of Update.
- Economy of storage i.e. ease of secondary memory
access. - Simple to maintain.
- Reliability factor.
15File Organization vs Access
- Pile Records are collected as they arrive.
Variable length records, Variable Set of Fields,
Chronological Order. Accessed by exhaustive
search. - Sequential Fixed length Records with fixed
number of fields arranged sequentially based on
some key field accessed strictly sequentially. - Indexed Sequential Single Index field searched
randomly followed by sequential access of
records. - Indexed Multi Level Index based Random access.
- Hashed (Random ) Direct Access search the start
of the relevant record by employing some hashed
key.
16Directory Structure
- Linear ( Rarely Used).
- Hierarchical
- a) Tree / Acyclic Graph Mostly Used.
- b) Cyclic Graph Management difficult.
17File System Software Architecture
- User Program
-
- File Organization
Logical I/O
Basic I/O Supervisor
Basic File System
Device Interface
18Typical Directory Structure
Root Directory
User 1
User 2
User N
.
Sub_ Directories
Different Files
19Information Storage Structure(Logical Vs.
Physical View)
Applications
Records
Structured Record Files / Logical Files
Record ? Byte Stream Translation
Byte Stream Files
Stream ? Block Translation
Storage Devices
Storage Blocks