0% found this document useful (0 votes)
4 views19 pages

Unit 5

The document discusses file systems and storage management, detailing the characteristics, attributes, operations, and access methods of files. It outlines various directory structures, including single-level, two-level, tree-structured, and acyclic-graph directories, emphasizing their functionalities and complexities. The document highlights the importance of file organization and management in operating systems for efficient data handling.

Uploaded by

Dharani Mani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views19 pages

Unit 5

The document discusses file systems and storage management, detailing the characteristics, attributes, operations, and access methods of files. It outlines various directory structures, including single-level, two-level, tree-structured, and acyclic-graph directories, emphasizing their functionalities and complexities. The document highlights the importance of file organization and management in operating systems for efficient data handling.

Uploaded by

Dharani Mani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Unit V

File System & Storage


Management
Files
A file is a named collection of related information
that is recorded on secondary storage.
The operating systems maps this logical storage
unit to the physical view of information storage.
A file may have the following characteristics
 File Attributes
 File Operations
 File Types
 File Structures
 Internal Files
File Attributes
File Name: The symbolic name is perhaps the only
human readable file attribute.
Identifier: A unique number assigned to each file
for identification purpose.
File Type: Some systems recognize various file
types. Windows is a good example.
File Location: A pointer to a device to find a file.
File Size: The current size of a file, or the
maximum allowed size.
File Protection: This is for access-control.
File Date, Time, Owner, etc.
File Operations: 1/2
A file can be considered as an abstract data type
that has data and accompanying operations.
Creating a file
Writing a file
Reading a file
Repositioning within a file
Deleting a file
Truncating a file
Other operations (e.g., appending a file, renaming a
file)
File Operations: 2/2
disk

system-wide process
open-file table open-file table file

file index
file pointer
file open count
one file disk location
access right
File Structure
Some systems support specific file types that
have special file structures.
For example, files that contain binary
executables.
An operating system becomes more complex
when more file types (i.e., file structures) are
supported.
In general, the number of supported file types
is kept to minimum.
File Access Methods
Access method: how a file be used.
There are three popular ones:
 Sequential access method for sequential files
 Direct access method for direct files
 Indexed access method for indexed files.
Sequential Access Method
With the sequential access method, the file is
processed in order, one record after the other.
If p is the file pointer, the next record to be
accessed is either p+1 or p-1 (i.e., backspace).

current record

beginning end of file


next record

rewind
read/write
Direct Access Method
A file is made up of fixed-length logical records.
The direct access method uses record number to
identify each record. For example, read rec 0, write
rec 100, seek rec 75, etc.
Some systems may use a key field to access a record
(e.g., read rec “Age=24” or write rec “Name=Dow”).
This is usually achieved using hashing.
Since records can be accessed in random order,
direct access is also referred to as random access.
Direct access method can simulate sequential access.
Indexed Access Method
With the indexed access method, a file is sorted in
ascending order based on a number of keys.
Each disk block may contain a number of fixed-
length logical records.
An index table stores the keys of the first block in
each block.
We can search the index table to locate the block
that contains the desired record. Then, search the
block to find the desired record.
This is exactly a one-level B-, B+ or B* tree.
Multi-level index access method is also possible.
data file
index table
last name logical rec #
Adams Ashcroft, … Asher, … Atkins
Arthur
Ashcroft

Smith, …. Sweeny, … Swell, …

Smith

index table is stored


In physical memory
Directory Structure: 1/2
A large volume disk may be partitioned into
partitions, or mini disks, or volumes.
Each partition contains information about files
within it. This information is stored in entries of a
device directory or volume table of content (VTOC).
The device directory, or directory for short, stores
the name, location, size, type, access method, etc of
each file.
Operations perform on directory: search for a file,
create a file, delete a file, rename a file, traverse the
file system, etc.
Directory Structure: 2/2
There are five commonly used directory
structures:
 Single-Level Directory
 Two-Level Directory
 Tree-Structure Directories
 Acyclic-Graph Directories
 General Graph Directories
Single-Level Directory
All files are contained in the same directory.
It is difficult to maintain file name uniqueness.
CP/M-80 and early version of MS-DOS use this
directory structure.
Two-Level Directory: 1/2
This is an extension of the single-level directory for
multi-user system.
Each user has his/her user file directory. The
system’s master file directory is searched for the user
directory when a user job starts.
Early CP/M-80 multi-user systems use this structure.
Two-Level Directory: 2/2
To locate a file, path name is used. For example,
/user2/bo is the file bo of user 2.
Different systems use different path names. For
example, under MS-DOS it may be C:\user2\bo.
The directory of a special user, say user 0, may
contain all system files.
Tree-Structured Directory
Each directory or subdirectory contains files and
subdirectories, and forms a tree.
Directories are special files.

/bin/mail/prog/spell
Acyclic-Graph Directory: 1/2
This type of directories
allows a file/directory to
be shared by multiple
directories.
This is different from
two copies of the same
file or directory.
An acyclic-graph
directory is more
flexible than a simple
file count is shared by directories tree structure.
dict and spell However, it is more
complex.
Acyclic-Graph Directory: 2/2
Since a file have multiple absolute path names, how do
we calculate file system statistics or do backup?
Would the same file be duplicated multiple times?
How do we delete a file?
If sharing is implemented with symbolic links, we
only delete the link if we have a list of links to the
file. The file is removed when the list is empty.
Or, we remove the file and keep the links. When the
file is accessed again, a message is given and the link
is removed.
Or, we can maintain a reference count for each
shared file. The file is removed when the count is
zero.

You might also like