0% found this document useful (0 votes)
24 views

File System Interface

This document discusses file systems and file interfaces. It begins by outlining objectives like defining files, file systems, file attributes, operations, access methods, sharing and protection. It then defines files and describes how they are organized in file systems with directories. File attributes and types are explained. Various file operations like create, open, read and write are covered. Different file access mechanisms like sequential, direct and indexed sequential access are described. The document also discusses file sharing and protection methods like access control lists.

Uploaded by

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

File System Interface

This document discusses file systems and file interfaces. It begins by outlining objectives like defining files, file systems, file attributes, operations, access methods, sharing and protection. It then defines files and describes how they are organized in file systems with directories. File attributes and types are explained. Various file operations like create, open, read and write are covered. Different file access mechanisms like sequential, direct and indexed sequential access are described. The document also discusses file sharing and protection methods like access control lists.

Uploaded by

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

File system Interface

Objectives

 File, file system


 Types of files
 File attributes
 File operations
 Access Methods
 File Sharing
 Protection
Concept of file

 A file is a named collection of related information


 Contagious logical address space
 recorded on secondary storage i.e magnetic disks, magnetic tapes and optical disks
 files represent programs (both source and object forms) and data.
File system

 abbreviated as FS
 method of organizing and retrieving files from a storage medium
  usually consist of  files separated into groups called directories
  Directories can contain files or additional directories
  commonly used file system with Windows is NTFS.
File Attributes

 A file’s attributes vary from one operating system to another but typically consist of these:
 Name: The symbolic file name is the only information kept in human readable form
 Identifier: usually a number, identifies the file within the file system
it is the non-human-readable name for the file
File Attributes cont..

Type: This information is needed for systems that support different types of files
Location: This information is a pointer to a device and to the location of the file on
that device
Size: The current size of the file (in bytes, words, or blocks) and possibly the maximum
allowed size are included in this attribute.
File Attributes cont..

 Protection: Access-control information determines who can do reading, writing,


executing, and so on.
 Time, date, and user identification: This information may be kept for creation, last
modification, and last use
Types

 Executable file: a file that runs a program when it is opened


 Batch file: A batch file is a kind of script file
 stored in a plain text file
 Text file: A text file is a sequence of characters organized into lines
 source file : it is a sequence of procedures and functions
 Object file: a file containing object code
Types cont..
Types cont..

 MS-DOS and UNIX have the following types of files


 Ordinary files
 Directory files
 Special files
Ordinary files

 These are the files that contain user information.


 These may have text, databases or executable program.
 The user can apply various operations on such files like add, modify, delete or even
remove the entire file.
Directory files

 These files contain list of file names and other information related to these files.
Special files
 these files are also known as device files.
 These files represent physical device like disks, terminals, printers, networks, tape drive
etc
File operations

 File operations:
 Create a file
 Open a file
 Write a file
 Read a file
 Close a file
 Truncate a file
File operations cont..

 Creating a file: Two steps are necessary to create a file


 First, space in the file system must be found for the file
 Second, an entry for the new file must be made in the directory
File operation cont..
 Writing a file: make a system call specifying both the name of the file and the information
to be written to the file
 Given the name of the file, the system searches the directory to find the file’s location.
 system must keep a write pointer to the location in the file where the next write is to take
place
File operation cont..

 Reading a file: use a system call that specifies the name of the file and where (in memory)
the next block of the file should be put
 system needs to keep a read pointer to the location in the file where the next read is to take
place
 Deleting a file: To delete a file, search the directory for the named file.
 erase the directory entry
File operations cont..

 truncating a file:The user may want to erase the contents of a file but keep its attribute
 this function allows all attributes to remain unchanged
File Access Mechanisms

 Sequential access
 Direct/Random access
 Indexed sequential access
Sequential access

 access is that in which the records are accessed in some sequence


  information in the file is processed in order
 i.e one record after the other
  Compilers usually access files in this fashion
Sequential access
Direct access

 Also called random access


 accessing the records directly
 Each record has its own address on the file through which it is accessed
Direct access cont..
Indexed sequential access

 This mechanism is built up on base of sequential access.


 An index is created for each file which contains pointers to various blocks
 Index is searched sequentially and its pointer is used to access the file directly
Indexed sequential access
File sharing

 file sharing is desirable for users who want to collaborate and to reduce the effort required
to achieve a computing goal
 Multiple users can share files
 When an OS accommodates multiple users, the issues of file sharing, file naming, and file
protection become preeminent.
File Protection

 File systems can be damaged by


 hardware problems ,power failures, head crashes, dirt, temperature extremes, and
vandalism
 Files may be deleted accidentally
 Bugs in the file-system software can also cause file contents to be lost.
How to protect

 by physically removing the floppy disks and locking them in a desk drawer or file cabinet
 provide controlled access by limiting the types of file access
 associate a password with each file
Type of access

 Access is permitted or denied depending on several factors, one of which is the ty


 Read: Read from the file
 Write: Write or rewrite the file
 Execute: Load the file into memory and execute it
 Append: Write new information at the end of the file
 Delete: Delete the file and free its space for possible reuse
 List: List the name and attributes of the file.pe of access requested
Access Control

 make access dependent on the identity of the user


 access-control list (ACL) specifying user names and the types of access allowed for each
user
 When a user requests access to a particular file
 operating system checks the access list associated with that file
Access control cont..

 If that user is listed for the requested access, the access is allowed
 Otherwise, a protection violation occurs
End of chapter

You might also like