File System Structures
1. File System Structures
- 
Purpose: Efficient access to disk, storing, locating, and retrieving data.
 - 
Layering Approach: Different layers handle specific tasks.
- Logical File System:
- Handles file metadata and directory structure.
 - Verifies file path and permissions.
 
 - File Organization Module:
- Maps logical blocks to physical blocks.
 - Manages free space.
 
 - Basic File System:
- Issues commands to I/O control for block fetching.
 
 - I/O Control:
- Accesses hard disk via device drivers.
 - Handles interrupts.
 
 
 - Logical File System:
 
2. File System Operations
- Create: Initializes a file with no data.
 - Open: Prepares a file for other operations.
 - Read: Accesses data within a file, managed by a read pointer.
 - Write: Adds data to a file and repositions the file pointer.
 - Reposition (Seek): Moves file pointer to a specific position.
 - Truncate: Deletes file data without releasing disk space.
 - Delete: Removes file and frees disk space.
 - Rename: Changes the file's name.
 - Append: Adds data to the end of a file.
 - Close: Closes the file, releasing resources and saving changes.
 
3. Storage Structures in Operating Systems

- Storage Hierarchy: Balance between speed, cost, and capacity.
- Registers: Fastest, smallest, used by CPU for quick access.
 - Cache Memory: Temporary storage for frequently accessed data.
 - Main Memory (RAM): Primary storage, larger but slower than cache.
 - Virtual Memory: Extends memory using hard disk space.
 - Secondary Storage: Stores data/programs not in use (e.g., HDDs, SSDs).
 - Tertiary Storage: Long-term storage (e.g., tape drives).
 
 
4. Flash Memory / Flash Storage
- Definition: Nonvolatile, high-speed, electrically programmable memory.
 - Types:
- NAND Flash: Optimized for high-density storage, serial access.
 - NOR Flash: Optimized for random access, parallel connections.
 
 - Examples: SSDs, USB drives, MMC, BIOS chips.
 - Applications: Widely used in consumer devices, industrial applications, and enterprise systems.
 
5. Flash Storage Optimization
- Enable TRIM: Helps manage data blocks efficiently.
 - Firmware Updates: Improve performance and reliability.
 - Wear Leveling: Distributes write/erase cycles evenly.
 - Over-Provisioning: Reserves space to maintain performance and lifespan.
 - Optimal File System: Use file systems like NTFS, exFAT, APFS.
 - Avoid Full Capacity: Keep 10-20% free space.
 - Avoid Unnecessary Writes: Minimize swap files and relocate temp files.
 - Temperature Management: Maintain recommended temperature range.
 - Regular Backups: Protect data against unexpected issues.
 - Check for Disk Errors: Use built-in tools for timely error detection.
 - Selective Indexing: Limit indexing to essential directories to reduce writes.