Upload
shaw
View
22
Download
0
Embed Size (px)
DESCRIPTION
FILE SYSTEM. Introduction. File System is a mechanism which is provided by the operating system to store and retrieve files on the disk. This system is primarily responsible for the management and organization of various files in a system. File Concept. - PowerPoint PPT Presentation
Citation preview
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
FILE SYSTEMFILE SYSTEM
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File System is a mechanism which is provided by the
operating system to store and retrieve files on the disk.
This system is primarily responsible for the
management and organization of various files in a
system.
IntroductionIntroduction
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
A file is a collection of related data stored as a named
unit on the secondary storage. It can store different
types of data, like text, graphics, database, executable
code, sound, videos, etc and on the basis of the data, a
file can be categorized as a data file, graphic file,
database file, executable file, sound file, video file,
etc.
File ConceptFile Concept
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
A file in a system is identified by its name. The file name helps
a user to locate a specific file in the system.
Different operating systems follow different file naming
conventions.
File attributes help the file system to manage a file within the
system. Files attributes may vary in different operating system.
File AttributesFile Attributes
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile AttributesHelps to identify and locate a Helps to identify and locate a file in the system.file in the system.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
Stores information about the Stores information about the current size of the file.current size of the file.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
Helps the operating system to Helps the operating system to recognize and use the recognize and use the recommended program to open recommended program to open a particular file type.a particular file type.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
A unique tag, usually a number A unique tag, usually a number that helps the file system to that helps the file system to recognize the file within the recognize the file within the file system.file system.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
A pointer that stores location A pointer that stores location information of the device and information of the device and location of the file on that location of the file on that device.device.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
Stores information such as date Stores information such as date and time of creation, last and time of creation, last modification and last use. This modification and last use. This is useful for protection, is useful for protection, security and monitoring.security and monitoring.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Name
• Size
• Type
• Identifier
• Location
• Date and Time
• Protection
File AttributesFile Attributes
Stores information about the Stores information about the access permissions (read, write, access permissions (read, write, execute) of different users.execute) of different users.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File operations are the functions that can be performed on a
file. Operating system handles the file operations through the
use of system calls. Various operations that can be performed
on a file are:
•Create a file
•Open a file
•Write to a file
•Read a file
File OperationsFile Operations
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Seek file
• Close file
• Delete file
• Append file
• Rename file
File OperationsFile Operations
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File operations are the functions that can be performed on a
file. Operating system handles the file operations through the
use of system calls. Various operations that can be performed
on a file are:
•Create a file
•Open a file
•Write to a file
•Read a file
File OperationsFile Operations
““create” create” system call is used to create a file. When system call is used to create a file. When this system call is used, the operating system this system call is used, the operating system searches for the free space in the file system and searches for the free space in the file system and allocates it to the file. In addition, the OS makes a allocates it to the file. In addition, the OS makes a directory entry to record the name, location and other directory entry to record the name, location and other information about the file.information about the file.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File operations are the functions that can be performed on a
file. Operating system handles the file operations through the
use of system calls. Various operations that can be performed
on a file are:
•Create a file
•Open a file
•Write to a file
•Read a file
File OperationsFile Operations
““open” open” system call accepts the file name and the system call accepts the file name and the access-mode as parameters to open a file and returns access-mode as parameters to open a file and returns a pointer to the entry in the a pointer to the entry in the open-file tableopen-file table. The OS . The OS searches the directory entry for the file name and also searches the directory entry for the file name and also checks the access permission.checks the access permission.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File operations are the functions that can be performed on a
file. Operating system handles the file operations through the
use of system calls. Various operations that can be performed
on a file are:
•Create a file
•Open a file
•Write to a file
•Read a file
File OperationsFile Operations
““write” write” system call accepts the file name and the system call accepts the file name and the data to be written to the file as parameters. The OS data to be written to the file as parameters. The OS searches the directory entry to locate the file and searches the directory entry to locate the file and writes data to the specified position in the file and writes data to the specified position in the file and also updates the write pointer to the location where also updates the write pointer to the location where next write operation is to take place.next write operation is to take place.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File operations are the functions that can be performed on a
file. Operating system handles the file operations through the
use of system calls. Various operations that can be performed
on a file are:
•Create a file
•Open a file
•Write to a file
•Read a file
File OperationsFile Operations
““read” read” system call accepts the file name, amount of system call accepts the file name, amount of data to be read and a read pointer to point to the data to be read and a read pointer to point to the position from where the data is to be read as position from where the data is to be read as parameters. The parameters. The current position pointercurrent position pointer will be will be updated after the read operation.updated after the read operation.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Seek file
• Close file
• Delete file
• Append file
• Rename file
File OperationsFile Operations““seek” seek” system call is used to position the pointer to a system call is used to position the pointer to a specific position in a file. Once the pointer is specific position in a file. Once the pointer is positioned, data can be read from and written to that positioned, data can be read from and written to that position.position.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Seek file
• Close file
• Delete file
• Append file
• Rename file
File OperationsFile Operations
““close” close” system call is used to close a file, when all system call is used to close a file, when all the operations on that file are completed. The OS the operations on that file are completed. The OS erase the file entry from the open-file table to make erase the file entry from the open-file table to make space for the new file entries.space for the new file entries.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Seek file
• Close file
• Delete file
• Append file
• Rename file
File OperationsFile Operations
““delete” delete” system call is used to delete a file, when a system call is used to delete a file, when a file is not required. The OS will erase its file is not required. The OS will erase its corresponding directory entry also.corresponding directory entry also.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Seek file
• Close file
• Delete file
• Append file
• Rename file
File OperationsFile Operations
““append” append” system call is used to add data at the end system call is used to add data at the end of an existing file. The system call works similar to of an existing file. The system call works similar to the the “write”“write” system call, except that it positions the system call, except that it positions the pointer to the end of the file and then performs the pointer to the end of the file and then performs the write operation.write operation.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
• Seek file
• Close file
• Delete file
• Append file
• Rename file
File OperationsFile Operations
““rename” rename” system call is used to change the name of system call is used to change the name of an existing file. The OS changes the directory entry an existing file. The OS changes the directory entry also.also.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
The most common technique to implement file type is by
providing extension to a file.
The file name is divided into two parts separated by a period,
where the first part is the name and the second part after the
period is the file extension.
A file extension is generally one to three characters long. The
extension indicates the type of the file and the operations (read,
write, execute) that can be performed on that file.
File TypesFile Types
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File TypesFile Types
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
The information stored in the file can be accessed as follows:
•Sequential Access
•Direct Access
Access MethodsAccess Methods
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
The information stored in the file can be accessed as follows:
•Sequential Access
•Direct Access
Access MethodsAccess Methods
Information from the file is accessed in order, one record after the Information from the file is accessed in order, one record after the other. Compilers, multimedia applications, sound files, etc. are the most other. Compilers, multimedia applications, sound files, etc. are the most common examples of programs using sequential access.common examples of programs using sequential access.In case of a read operation, the record at the location pointed by the file In case of a read operation, the record at the location pointed by the file pointer is read and the file pointer is then advanced to the next record. pointer is read and the file pointer is then advanced to the next record. In case of write operation, the record is written to the end of the file and In case of write operation, the record is written to the end of the file and pointer is advanced to end of new record.pointer is advanced to end of new record.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
The information stored in the file can be accessed as follows:
•Sequential Access
•Direct Access
Access MethodsAccess Methods
Under direct access, a file is viewed as a sequence of blocks (or Under direct access, a file is viewed as a sequence of blocks (or records) which are numbered. The records of a file can be read or records) which are numbered. The records of a file can be read or written in any order using this number. The block number is relative to written in any order using this number. The block number is relative to the beginning of the file. This relative number internally has an actual the beginning of the file. This relative number internally has an actual absolute disk address and this mapped by the file system. In direct absolute disk address and this mapped by the file system. In direct access, the system calls for read and write operations are using the access, the system calls for read and write operations are using the block number as parameter.block number as parameter.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
To manage the data stored on a disk, the disk is divided into
one more partitions also known as volumes and each partition
contains information about the files in it. This information is
stored in directory.
Directory StructureDirectory Structure
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Operations Performed on DirectoryOperations Performed on Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system
It is possible to have more than one operating system on a single disk, where a user can boot any of the operating system.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Organize the Directory (Logically) to ObtainOrganize the Directory (Logically) to Obtain Efficiency – locating a file quickly Naming – convenient to users
Two users can have same name for different files
Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, …)
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Single-Level DirectorySingle-Level Directory A single directory for all users
Naming problem – No two files can have the same name.
Grouping problem – Only one directory is available for all users.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Two-Level DirectoryTwo-Level Directory Separate directory for each user (MFD, UFD)
Path name
Can have the same file name for different user
Efficient searching
No grouping capability
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Tree-Structured DirectoriesTree-Structured Directories
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
ProtectionProtection
The information stored in a system requires to be protected from the physical damage and unauthorized access.
A file system can be damaged due to various reasons such as, a system breakdown, theft, fire, lightning or any other nature calamities.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
ProtectionProtection
When the physical damage is irreversible, the data can be lost permanently.
Physical damage to a system is unavoidable, we must take proper measures to safeguard and protect the data.
Protection can be provided by storing a copy of information on the disk to the disk itself, or to some other removable storage media.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
ProtectionProtection
Apart, from protecting the file from physical damage, the file in a system also needs a protection mechanism to control improper access.
In a multi-user system, one user can access files of other users, and the system is prone to improper access. A protection mechanism is necessary in such a situation.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Types of AccessTypes of AccessDifferent access rights that can be assigned to a particular user for a particular file are:Read – Allow only reading the file.Write – Allow write or rewriting the file.Execute – Allow running the program or application.Append – Allow writing new information at the end of file.Copy – Allow creating a new copy of the file.Rename – Allow renaming a file.Edit – Allow adding or deleting information from the file.Delete – Allow deleting the file and releasing the space.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
Access ControlAccess ControlAccess control is to protect the file from improper accesses.PasswordAccess Control List (ACL)
To resolve the problems associated with ACL, the users can be categorized as:OwnerGroupUniverse
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File System StructureFile System StructureFile system helps to organize, manage and retrieve data on the disk. The file system resides permanently on the disk.
Two key issues in the design of file system:Defining a file and attributes, operations that can be performed on a file and the directory structure.Creating data structures and algorithms for mapping the logical file system into the secondary storage device.
SOCSAMS e-learning
Dept. of Computer Applications, MES College Marampally
File System LayersFile System Layers