File Management in Operating Systems Study Guide
Fundamentals of File Management
- Efficiency Drivers: The File Manager's efficiency is directly affected by:
- Organization of system files.
- Storage methods for files.
- Structural arrangement of records within each file.
- Protection of user access to all files.
- Definition: The File Management System is a specific layer of software responsible for creating, deleting, modifying, and controlling access to files.
- Primary Tasks of the File Manager:
- File Storage Tracking: Monitoring where every file is located within secondary storage.
- Policy Implementation: Deciding where and how files are stored based on system rules.
- Resource Allocation: Determining whether a user has cleared access permissions and then loading the requested file into main memory.
- Deallocation: Returning a file to secondary storage and notifying other processes of its availability.
Policy Implementation and Security
- Policy Determination: Policies dictate the physical location of storage and govern both system and user access rights.
- Flexibility of Access: A key factor in policy is providing flexible access to information. This includes:
- Allowing for file sharing.
- Providing distributed access to files across a network.
- Enabling users to browse public directories.
- Information Protection: A secondary factor focusing on preventing malfunctions and ensuring security. This involves:
- Performing security checks.
- Managing account numbers and passwords.
- Operational Procedures:
- Allocation: Once access is cleared, the system activates the secondary storage device, loads the file into memory, and updates relevant records.
- Deallocation: The system updates file tables, rewrites the file to storage if it was revised, and notifies any waiting processes that the file is now available.
Data Hierarchy and Definitions
- Field: A group of related bytes. It is identified by the user with attributes such as name, type, and size.
- Record: A group of related fields.
- File: A group of related records. These are used by specific application programs (e.g., for report generation).
- Flat File: A specific type of file with no connections to other files and no inherent dimensionality.
- Database: A group of related files interconnected at various levels. These provide users with high flexibility for accessing stored data.
- Program Files: Files that contain executable instructions for the computer.
- Data Files: Files that contain raw data or information processed by programs.
- Directories (Folders): System listings containing filenames and their associated attributes.
Interacting with the File Manager
- Common User Commands: The most frequent interactions include OPEN, DELETE, RENAME, and COPY operations.
- Device Independence: The File Manager provides an abstraction layer so users do not need technical knowledge of:
- Physical Location: Knowledge of specific cylinders, surfaces, or sectors is unnecessary.
- Device Medium: Knowledge of whether the file is on tape, magnetic disk, optical disc, or flash storage is not required.
- Network Structure: Users do not need to understand network hardware or topology to access files.
- Command Processing (Logical to Physical):
- Users issue high-level logical commands (e.g., READ).
- The system breaks these into lower-level signals.
- The READ Sequence:
- Move read/write heads to the specific record cylinder.
- Wait for rotational delay (until the sector containing the record passes under the head).
- Activate the appropriate read/write head to read the record.
- Transfer the record data to main memory.
- Send a flag indicating the device is free for another request.
- The system continuously monitors for error conditions during these steps.
Volume Configuration and Directory Structures
- Volume: A unit of secondary storage, which can be removable or non-removable.
- Multi-file Volume: A single storage unit containing many different files.
- Multi-volume Files: A single, extremely large file that is spread across multiple physical volumes.
- Volume Descriptor: Stored at the beginning of each volume (e.g., the innermost part of a CD, beginning of a tape, or first sector of the outermost track). It contains vital identifying information about the storage unit.
- Master File Directory (MFD): Located immediately after the volume descriptor. It lists names and characteristics of every file and subdirectory in the volume.
- Structure Evolution:
- Single Directory per Volume: Supported by early OS models. Disadvantages included long search times, directory space filling before disk space, inability to safeguard individual files, and the requirement for every program to have a unique name even if used by multiple users.
- Subdirectories: Improvement over single directories. Created when an account is opened and treated as a file with a specific subdirectory flag in the MFD.
- Modern Tree Structure: Implemented as an "upside-down tree." The "root" is the MFD, nodes are directory files, and branches point to other directories or real files ("leaves").
File-Naming Conventions
- Components: A standard file name includes a relative filename and an extension.
- Absolute Filename: Also known as the complete filename, it includes the full path information from the root.
- Relative Filename: The name without path info, used for differentiation within a specific directory. Length and character rules are OS-specific.
- Operating System Naming Parameters:
- UNIX: Case-sensitive; Special characters (not allowed):
*, ?, $, &, [, ], /, \; Max length: 256 characters; Extensions not required. - Mac OS X: Case-sensitive; Special characters:
: (Colon) not allowed; Max length: 255 characters; Extensions not required. - Windows: Not case-sensitive; Most special characters not allowed; Max length: 255/256 characters; Extensions required.
- Linux: Case-sensitive; Same special character restrictions as UNIX; Max length: 256 characters; Extensions not required.
- MS-DOS: Not case-sensitive; Only hyphens and underscores allowed; Max length: 8.3 format; Extensions required.
- Extensions: Usually 2-4 characters long, separated by a period. They identify the file type (e.g., BASIA_TUNE.AVI). Unknown extensions require user intervention.
- Fixed-length Records: Ideal for direct access. Record size is critical. If data exceeds the field limit, it is truncated.
- Variable-length Records: Difficult for direct access but efficient for sequential access (e.g., text or program files). No empty space is wasted, and truncation does not occur. These often require an index for access.
- Selection Factors for Organization Schemes: Data volatility, file activity, file size, and required response time.
- Sequential Record Organization:
- Records are stored and retrieved serially.
- Optimization: Selecting a key field and sorting records before storage.
- Maintenance: Challenging to preserve order when adding or deleting records.
- Direct Record Organization:
- Requires Direct Access Storage Devices (DASD).
- Uses logical addresses (Relative addresses) computed during storage/retrieval.
- Hashing Algorithms: Transform a key into a specific number for addressing.
- Advantages: Fast access; updated quickly.
- Disadvantages: Hashing collisions (unique keys generating the same address).
- Indexed Sequential Record Organization:
- Implemented via Indexed Sequential Access Method (ISAM) software.
- Combines benefits of sequential and direct access; no collisions.
- Generates an index file containing the highest record key and physical block location for equal-sized blocks within the ordered sequential file.
Physical Storage Allocation
- Contiguous Storage: Records are stored one after another in a continuous block.
- Advantages: Easy direct access once the start address and record size are known.
- Disadvantages: Difficult file expansion; leads to fragmentation.
- Noncontiguous Storage: Uses any available disk space. Records are stored in "extents" linked by pointers if empty space is not contiguous.
- Extents: Typically 256 bytes.
- Advantages: Eliminates external fragmentation and the need for compaction.
- Disadvantages: Does not support direct access (chained storage); record locations are hard to determine.
- Indexed Storage: Each file has its own index block.
- Supports both sequential and direct access.
- Does not necessarily improve overall storage space usage.
Access Methods and Calculations
- Current Byte Address (CBA): Updated every time a record is accessed.
- Sequential Access Calculations:
- Fixed-length: CBA=CBA+RL (where RL is record length).
- Variable-length: CBA=CBA+N+RL (where N is the number of bytes used to store the record details).
- Direct Access Calculations:
- Fixed-length: CBA=(RN−1)×RL (where RN is the desired record number).
- Variable-length: Virtually impossible to calculate directly; requires a sequential search or a table of CBAs for every record number.
Access Control Verification
- Actions Protected: READ only, WRITE only, EXECUTE only, DELETE only, or combinations thereof.
- Access Control Matrix:
- A table showing rights for each user per file.
- Easy to implement for a few users/files but grows too large for main memory and wastes space with null entries.
- Access Control Lists (ACL):
- Modification of the matrix listing users granted access to a specific file. More space-efficient.
- Categories: SYSTEM (Admin), OWNER (absolute control), GROUP (authorized members), WORLD (everyone else).
- Capability Lists: Lists every user and their respective file access. This is the most common method and can also control access to devices.
Data Compression Techniques
- Lossless Compression: Retains all data; essential for text or arithmetic files.
- Lossy Compression: Irreversible; removes data without compromising perceived quality (e.g., sound/image). Original files cannot be reconstructed.
- Text Compression Methods:
- Repeated Characters: Replaced with a specific code.
- Repeated Terms: Common words (e.g., student, course) replaced with single-character symbols.
- Front-end Compression: Taking a set number of characters from a previous entry that have commonalities with the current entry.
- Standards and Formats:
- JPEG: Used for still images.
- MPEG: Used for video images.
- ISO: The International Organization for Standardization is the world lead for these international standards.