150 likes | 229 Views
File Management . Chapter 12. File System. Permits users to create data collections (files) which has the following properties Long-term existence – stored on disk/LT-storage Sharable between processes – access permissions
E N D
File Management Chapter 12
File System • Permits users to create data collections (files) which has the following properties • Long-term existence – stored on disk/LT-storage • Sharable between processes – access permissions • Structure – an internal structure convenient for particular applications • Functions that can be performed on files • Create / Delete; Open / Close; Read / Write • File Structure • Field – the basic element of data • Record – a collection of related fields that can be treated as a unit (e.g. an employee record with name, SSN, address, etc.) • Database – a collection of related data and operations defined upon them (usually database management system is independent of the OS) Note that on UNIX systems, the basic file structure is just a stream of bytes (e.g. a C program file does not have fields, records, and so on)
File Management System • Set of system software that provides services to users and applications in the use of files Objectives • Meet the data management needs of the user (e.g. file storage and operations – R/W, create/delete, access rights) • Optimize performance (e.g. maximize throughput/response time) • Provide I/O support for a variety of storage device types • Minimize or eliminate the potential for lost or destroyed data • Provide a standardized set of I/O interface routines • Provide I/O support for concurrent access to files Functions • Identify and locate a selected file • Use a directory to describe the location of all files plus their attributes • I/O is done on a block basis – conversions between blocks and records • Allocate files to free blocks • Manage & organize the free storage
File Organization and Access • File Organization: logical structuring of the records as determined by the way in which they are accessed • Physical Organization: depends on the blocking and file allocation strategy • Criteria for choosing a file organization: • Short access time • Ease of update • Economy of storage • Simple maintenance • Reliability • Different Organizations • The pile • The sequential file • The indexed sequential • The indexed • The direct, or hashed, file
Different file Organizations • The pile • The sequential file • The indexed sequential • The indexed
File Directories • Contains information about files • Attributes • Location • Ownership • Directory itself is a file owned by the OS • Provides mapping between file names and the files themselves
Hierarchical, or Tree-Structured Directory • Master directory with user directories underneath it • Files can be located by following a path from the root • Current directory = working directory • Files are referenced relative to the working directory
UNIX File Management • Types of files • Regular / ordinary • Directory • Special • Named pipes • Links • Symbolic links • Inodes • Index node • Control structure that contains key information for a particular file
File Allocation Methods for Secondary Storage Management • Contiguous allocation • single entry in the File Allocation Table (FAT) - Starting block and the length • External fragmentation may occur compaction needed
File Allocation (cont.) • Chained allocation • Each block contains a pointer to the next block in the chain • single entry in the FAT - Starting block and the length • No external fragmentation • Best for sequential files – quick access to the record • No accommodation of the principle of locality After consolidation
File Allocation (cont.) • Indexed allocation • File allocation table contains a one-level index for each file • The index has one entry for each portion allocated to the file • The file allocation table contains block number for the index Indexed Allocation with variable-length portions Indexed Allocation with block portions
Linux Virtual File System • Designed to support a wide variety of file management systems • VFS provides a uniform file system interface to user processes • Represents any conceivable file system’s general feature and behavior • Assumes files are objects that share basic properties regardless of the target system Files on secondary Storage maintained By file system X