chapter 13
DESCRIPTION
Chapter 13. File Systems. Long Term Information Storage. Three essential requirements for long-term information storage: Must store large amounts of data Information stored must survive the termination of the process using it - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/1.jpg)
File Systems
![Page 2: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/2.jpg)
Long Term Information StorageThree essential requirements for long-
term information storage:Must store large amounts of dataInformation stored must survive the
termination of the process using itMultiple processes must be able to access the
information concurrently
![Page 3: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/3.jpg)
What is a File?To abstract away the properties of the
storage device, the operating system defines a logical storage unit, called a file.
From the user point of view, a file is the smallest allotment logical secondary storage – that is, data cannot be written to secondary storage unless they are within a file.
![Page 4: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/4.jpg)
Types of FilesSource programsObject programsExecutable programsNumeric dataGraphic imagesSound recording
![Page 5: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/5.jpg)
File Types
![Page 6: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/6.jpg)
File StructureA file has a certain defined structure
according to its type:A text file is a sequence of characters organized
into lineA source file is a sequence of functions each of
which is organized as declaration and 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.
![Page 7: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/7.jpg)
File SystemFiles are managed by the operating system
(how they are named, structured, used etc).The part of the operating system dealing with
files is known is the file system.
![Page 8: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/8.jpg)
File AttributesName – only information kept in human-readable
form.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, and usage monitoring.Information about files are kept in the directory
structure, which is maintained on the disk.
![Page 9: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/9.jpg)
File OperationsCreateWriteReadReposition within file – file seekDeleteTruncateOpen(Fi) – search the directory structure on disk
for entry Fi, and move the content of entry to memory.
Close (Fi) – move the content of entry Fi in memory to directory structure on disk.
![Page 10: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/10.jpg)
File StructureFile types may also be used to indicate the
internal structure of the file.Files can be structured in any of the several
ways.Three common possibilities are:
Byte sequenceRecord sequenceTree
![Page 11: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/11.jpg)
File Structure
![Page 12: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/12.jpg)
Access MethodsThe information in the file can be accessed in
several ways.Common access methods are:
Sequential accessDirect accessIndexed methods
![Page 13: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/13.jpg)
Sequential AccessThe information is processed in order, one record
after the other.Read operation reads the next portion of the file and
advances the file pointer automatically.A write operation appends at the end of the file and
EOF is advanced.A rewind operation brings the file pointer to the
beginning of the file.
![Page 14: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/14.jpg)
Direct or Relative AccessThe file is made up of fixed length logical
records.It allows arbitrary blocks to be read or
written. The read operation includes block number as
a parameter. The block number provided to the operating system is relative to the beginning/end of file or the current position of the file.
![Page 15: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/15.jpg)
Indexed MethodsCan be built on the top of a direct-access method.Involve construction of an index which contains
pointers to the various blocks.To find a record, we first search the index, and then
use the pointer to access the file directly and find the desired record.
![Page 16: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/16.jpg)
Directory StructureThe files on a secondary storage need to be organized
because a huge number of files which might be stored on it.
This is generally done in two steps:Disks are split into partitions (also called minidisk
or volumes). Each disk typically contains at least one partition.
Each partition contains information about files within it. This information is kept in entries in a device
directory (or simply a directory) or volume table of contents.
![Page 17: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/17.jpg)
Directory Structure
F 1 F 2 F 3 F 4
F n
Directory
Files
![Page 18: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/18.jpg)
Information in a Device DirectoryName TypeAddress Current lengthMaximum lengthDate last accessed (for archival)Date last updated (for dump)Owner ID (who pays)Protection information (discuss later)
![Page 19: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/19.jpg)
Operation Performed on DirectorySearch for a fileCreate a fileDelete a fileList a directoryRename a fileTraverse the file system
![Page 20: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/20.jpg)
Single-Level Directory
![Page 21: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/21.jpg)
Two-Level DirectoryEach user has his own user file directory (UFD).Each UFD has a similar structure but lists only the
files of a single user.When a user job starts or user logs in, the system’s
master file directory (MFD) is searched.The MFD is indexed by user name or account number,
and each entry points to the UFD for that user.User directories can be created and deleted.
Path nameCan have the same file name for different userEfficient searchingNo grouping capability
![Page 22: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/22.jpg)
Two-Level Directory
![Page 23: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/23.jpg)
Tree-Structured or Hierarchical Directory SystemsA natural extension of two-level directory
system.It allows a user to create his own sub-
directories.A directory is simply another file but is
treated in a special way.A (sub)directory contains a list of files or sub-
directories.Special system calls are used to create and
delete sub-directories.
![Page 24: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/24.jpg)
Tree-Structured or Hierarchical Directory Systems
![Page 25: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/25.jpg)
Path NamesWhen file system is organized as a directory tree,
some way is needed for specifying file names.Two different methods are commonly used.Each file is given an absolute path name consisting
of the path from the root directory to the file (e.g. /usr/bin/cc).
The relative path name id used in conjunction with the concept of the working directory (or current working directory) and all path names are taken relative to the current working directory.
Tree structure prohibits the sharing of files or directories.
![Page 26: Chapter 13](https://reader035.vdocuments.site/reader035/viewer/2022062410/568158c5550346895dc60e3b/html5/thumbnails/26.jpg)
A UNIX directory tree