1 / 26

Chapter 13

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

tuyen
Download Presentation

Chapter 13

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 13 File Systems

  2. 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 • Multiple processes must be able to access the information concurrently

  3. 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.

  4. Types of Files • Source programs • Object programs • Executable programs • Numeric data • Graphic images • Sound recording

  5. File Types

  6. File Structure • A file has a certain defined structure according to its type: • A text file is a sequence of characters organized into line • A 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.

  7. File System • Files 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.

  8. File Attributes • Name – 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.

  9. File Operations • Create • Write • Read • Reposition within file – file seek • Delete • Truncate • Open(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.

  10. File Structure • File 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 sequence • Record sequence • Tree

  11. File Structure

  12. Access Methods • The information in the file can be accessed in several ways. • Common access methods are: • Sequential access • Direct access • Indexed methods

  13. Sequential Access • The 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.

  14. Direct or Relative Access • The 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.

  15. Indexed Methods • Can 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.

  16. Directory Structure • The 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.

  17. Directory Structure

  18. Information in a Device Directory • Name • Type • Address • Current length • Maximum length • Date last accessed (for archival) • Date last updated (for dump) • Owner ID (who pays) • Protection information (discuss later)

  19. Operation Performed on Directory • Search for a file • Create a file • Delete a file • List a directory • Rename a file • Traverse the file system

  20. Single-Level Directory

  21. Two-Level Directory • Each 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 name • Can have the same file name for different user • Efficient searching • No grouping capability

  22. Two-Level Directory

  23. Tree-Structured or Hierarchical Directory Systems • A 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.

  24. Tree-Structured or Hierarchical Directory Systems

  25. Path Names • When 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.

  26. A UNIX directory tree

More Related