File-System Interface & File System Implementation I

File-System Interface & File System Implementation I

File-System Interface & File System Implementation I Lecture 10 Dr. Cem Özdogan˘ File-System Interface & File System Implementation I File-System Interface Lecture Information File Concept File Attributes File Operations An Example Program Ceng328 Operating Systems at May 04, 2010 Using File System Calls File Types Internal File Structure Access Methods Sequential Access Direct (Random) Access Directory Structure Storage Structure Directory Overview Single-Level Directory Two-Level Directory Tree-Structured Directories Acyclic-Graph Directories File-System Mounting File Sharing Dr. Cem Özdogan˘ Multiple Users Protection Computer Engineering Department Types of Access Çankaya University Access Control 10.1 File-System Interface & Contents File System Implementation I 1 File-System Interface Dr. Cem Özdogan˘ File Concept File Attributes File Operations An Example Program Using File System Calls File Types Internal File Structure File-System Interface Access Methods File Concept File Attributes Sequential Access File Operations Direct (Random) Access An Example Program Using File System Calls Directory Structure File Types Storage Structure Internal File Structure Access Methods Directory Overview Sequential Access Single-Level Directory Direct (Random) Access Two-Level Directory Directory Structure Storage Structure Tree-Structured Directories Directory Overview Acyclic-Graph Directories Single-Level Directory Two-Level Directory File-System Mounting Tree-Structured Directories Acyclic-Graph Directories File Sharing File-System Mounting Multiple Users File Sharing Multiple Users Protection Protection Types of Access Types of Access Access Control Access Control 10.2 File-System Interface & File-System Interface I File System Implementation I Dr. Cem Özdogan˘ • Since main memory is usually too small, the computer system must provide secondary storage to back up main memory. • The file system provides the mechanism for storage of and (multiple) access to both data and programs residing on File-System Interface the disks. File Concept File Attributes • File Management System: Bridges the gap between File Operations An Example Program low-level disk organization (an array of blocks) and the Using File System Calls File Types user’s views (a stream or collection of records) (mapped). Internal File Structure • Access Methods Some devices transfer a character or a block of characters Sequential Access at a time. Direct (Random) Access Directory Structure • Some can be accessed only sequentially, others randomly. Storage Structure • Directory Overview Some transfer data synchronously, others asynchronously. Single-Level Directory • Some are dedicated, some shared. Two-Level Directory • Tree-Structured Directories They can be read-only or read-write. Acyclic-Graph Directories • File-System Mounting Also includes tools outside the kernel; formatting, File Sharing Multiple Users recovery, defrag, consistency, backup utilities (system Protection administration). Types of Access Access Control 10.3 File-System Interface & File-System Interface II File System Implementation I Dr. Cem Özdogan˘ • In many ways, they are also the slowest major component of the computer. • A file is a collection of related information defined by its creator. File-System Interface • The file system consists of two distinct parts: File Concept File Attributes 1 a collection of files; File Operations An Example Program 2 a directory structure; Using File System Calls File Types • Objectives for a file management system; Internal File Structure Access Methods • Provide a convenient naming system for files. Sequential Access • Direct (Random) Access Provide a standardized set of I/O interface routines and Directory Structure provide access control for multiple users. Storage Structure • Directory Overview Guarantee that the data in the file are valid. Minimize or Single-Level Directory eliminate the potential for lost or destroyed data. Two-Level Directory Tree-Structured Directories • Optimize performance. Acyclic-Graph Directories • File-System Mounting How do you keep one user from reading another’s data? File Sharing • How do you know which blocks are free? Multiple Users Protection Types of Access Access Control 10.4 File-System Interface & File Concept File System Implementation I • Think of a disk as a linear sequence of fixed-size blocks Dr. Cem Özdogan˘ and supporting reading and writing of blocks. • The OS abstracts from the physical properties of its storage devices to define a logical storage unit, the file. • A file is a named collection of related information that is recorded on secondary storage, with two views: File-System Interface • Logical (programmer) view, File Concept • File Attributes Physical (OS) view, File Operations • An Example Program The information in a file is defined by its creator. Using File System Calls • File Types Data files may be numeric, alphabetic, alphanumeric, or Internal File Structure binary. Access Methods • Sequential Access Files may be free form, such as text files, or may be Direct (Random) Access formatted rigidly. Directory Structure Storage Structure • A file has a certain defined structure, which depends on its Directory Overview Single-Level Directory type. Two-Level Directory • Tree-Structured Directories A text file; (sequence of characters) Acyclic-Graph Directories • A source file; (sequence of subroutines and functions) File-System Mounting • File Sharing An object file is a sequence of bytes organized into blocks Multiple Users understandable by the system’s linker. Protection Types of Access • An executable file is a series of code sections that the Access Control loader can bring into memory and execute. 10.5 File-System Interface & File Attributes I File System Implementation I When a file is named, it becomes independent of the process, Dr. Cem Özdogan˘ the user, and even the system that created it. File-System Interface File Concept File Attributes File Operations An Example Program Using File System Calls File Types Internal File Structure Access Methods Sequential Access Direct (Random) Access Directory Structure Storage Structure Directory Overview Single-Level Directory Two-Level Directory Tree-Structured Directories Acyclic-Graph Directories File-System Mounting File Sharing Multiple Users Figure: Some possible file attributes. Protection Types of Access Access Control 10.6 File-System Interface & File Attributes II File System Implementation I • The table of Fig. 1 shows some of the possibilities, but Dr. Cem Özdogan˘ other ones also exist. No existing system has all of these, but each one is present in some system. • A file’s attributes vary from one OS to another but typically consist of these: File-System Interface • Name. File Concept • File Attributes Identifier. This unique tag, usually a number, identifies the File Operations file within the file system (non-human-readable name) An Example Program Using File System Calls • Type. File Types • Internal File Structure Location. This information is a pointer to a device and to Access Methods the location of the file on that device. Sequential Access • Direct (Random) Access Size. The current size of the file (in bytes, words, or blocks) Directory Structure and possibly the maximum allowed size. Storage Structure Directory Overview • Protection. Access-control information determines who can Single-Level Directory Two-Level Directory do reading, writing, executing, and so on. Tree-Structured Directories • Time, date, and user identification. This information may Acyclic-Graph Directories File-System Mounting be kept for creation, last modification, and last use. File Sharing Multiple Users • The information about all files is kept in the directory Protection Types of Access structure, which also resides on secondary storage. Access Control 10.7 File-System Interface & File Operations I File System Implementation I Dr. Cem Özdogan˘ • A file is an abstract data type. To define a file properly, we need to consider the operations that can be performed on files. • Six basic file operations. The OS can provide system calls File-System Interface to create, write, read, reposition, delete, and truncate files. File Concept • File Attributes Creating a file. Two steps are necessary to create a file. File Operations An Example Program 1 Space in the file system must be found for the file. Using File System Calls 2 An entry for the new file must be made in the directory. File Types Internal File Structure • Writing a file. The write pointer must be updated whenever Access Methods Sequential Access a write occurs. Direct (Random) Access • Reading a file. The system needs to keep a read pointer to Directory Structure Storage Structure the location in the file where the next read is to take place. Directory Overview • Because a process is usually either reading from or writing to Single-Level Directory Two-Level Directory a file, the current operation location can be kept as a Tree-Structured Directories per-process current-file-position pointer. Acyclic-Graph Directories • File-System Mounting Both the read and write operations use this same pointer, File Sharing saving space and reducing system complexity. Multiple Users Protection Types of Access Access Control 10.8 File-System Interface & File Operations II File System Implementation I • Repositioning within a file. The directory is searched for Dr. Cem Özdogan˘ the appropriate entry, and the current-file-position pointer is repositioned to a given value (file seek). • Deleting a file. To delete a file, we search the directory for the named file. Having

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    44 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us