File Management PDF
Document Details
Uploaded by HalcyonJoy8377
Angelika S. Balagot
Tags
Summary
This document is a lecture on file management, covering topics such as file concepts, access methods, and file operations. It also examines directory structures and file management system structures. The document discusses data compression as well.
Full Transcript
File Management Angelika S. Balagot Instructor Overview File Manager File Concept File Access Methods File Types File Operations Directory Structure z File Management System Structure Data Compression The File Manager File Manager is...
File Management Angelika S. Balagot Instructor Overview File Manager File Concept File Access Methods File Types File Operations Directory Structure z File Management System Structure Data Compression The File Manager File Manager is also called the File Management System and is the software responsible for: - Creating, deleting, modifying, controlling access to files Provides support for libraries of programs z to online users, for spooling operation, and for interactive computing. File Concept Files are the building blocks of any operation system. Permanent storage of information & data. OS is not interested in what information is stored in file. OS maps files with physical devices. User prepare a program (file), File z represent program and data. The output of program is called executable file. File Access Methods File access mechanism refers to the manner in which the records of a file may be accessed. There are several ways to access files: Sequential File Access Direct File Access z Indexed File Access Access Methods: Sequential File Access Is a method of accessing data sequentially/one record at a time by starting from the beginning of the file to its end. This access method is the most primitive and straightforward z method of accessing files. Advantage: simple, easy to implement and use. Disadvantage: slow and inefficient for random access operations or when working with large files Access Methods: Direct File Access Also known as Random file access. Allows users to access data directly from any location within the file without the need to read/write all the records that come before it. Advantage: speed and efficiency for z random access operations. Disadvantage: more complex and difficult to implement and use than sequential file access. Access Methods: Indexed File Access Is a method that incorporates the benefits of both sequential and direct file access. Creating an index file that maps logical keys or data elements to their corresponding physical addresses within the file. Index is searched sequentially and its z pointer is used to access the file directly. Advantage: speed and efficiency for random and sequential access operations. Disadvantage: requires additional storage for the index, increase the cost and complexity of the system. File types File type refers to the ability of the operating system to distinguish different types of file such as text files, source files, and binary files etc. Many operating systems support many types of files. Operating system like MS-DOS and UNIX have the following types of files: z Ordinary files Directory files Special files File types: Ordinary files These are the files that contains 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. z File types: Directory files Directory files contains list of file and other related information to those files. Also known as “folders” in other operating systems. Folders that holds and organize multiple files. z File types: Special Files These files are also known as device files. Represents physical devices like - disks, terminals, printers, networks, tape drive etc. These files are of two types: Character special files − data z is handled character by character as in case of terminals or printers. Block special files − data is handled in blocks as in the case of disks and tapes. File Operations Create: The file is created with no data. Delete: File must has to be deleted when it is no longer needed just to free up the disk space. Open: The process must open the file before using it. Close: The file must be closed to free up the internal table space, z when all the accesses are finished and the attributes and the disk addresses are no longer needed. Read: The file read operation is performed just to read the data that are stored in the required file. File Operations Write: The file write operation is used to write the data to the file, again, generally at the current position. Append: The file append operation is same as the file write operation except that the file append operation only add the data at the end of the file. z Seek: For random access files, a method is needed just to specify from where to take the data. Therefore, the file seek operation performs this task. Rename: The file rename operation is used to change the name of the existing file. Directory Structure Directory is a list of files that stores all the related information about the file it hold with the contents. Directory is a list of files. Each entry of a directory define a file information like a file name, type, its version number, size ,owner of file, access rights, date of creation and date of last backup. z Types: 1. Single-level directory structure 2. Two-level directory structure 3. Tree-structured directory structure Directory Structure 1. Single-level directory structure - in a single level directory system, all the files are placed in one directory z Directory Structure 2. Two-level directory structure - in the two-level directory system, the system maintains a master block that has one entry for each user. z Directory Structure 3. Tree-structured directory structure - in the tree-structured directory, the directory themselves are files. This files to the possibility of having sub-directories that can contain files and sub- subdirectories z File Management System Structure Layered File System - there are 6 layers z File Management System Structure Application Program Layer: - user creates application program Logical File System Layer: - manages the meta data information z File Organization Module Layer: - maintain information about file File Management System Structure Basic File System Layer: - generate command for device driver - also manage buffer memory and cache I/O Control Interface Layer: - it consists of device driver & interrupt z handler - transfer data: between main memory to disk system. Physical Hardware Device Layer: - contain actual hardware device Data Compression A reduction in the amount of bits required to represent data is known as data compression. Compressing data can save storage capacity, speed up file transfer and decrease costs for storage hardware and network bandwidth. z How compression works Compression is performed by a program that uses a formula or algorithm to determine how to shrink the size of the data. For instance, an algorithm may represent a string of bits -- or 0s and 1s -- with a smaller string of 0s and 1s by using a dictionary for the conversion between them. When information is sent or received via the internet, larger files -- either z singly or with others as part of an archive file -- may be transmitted in a ZIP, GZIP or other compressed format. Summary File Manager File Concept File Access Methods File Types File Operations Directory Structure z File Management System Structure Data Compression End of Discussion Angelika S. Balagot Instructor