M10-OS File Systems Support - Tagged

CS 439 Principles of Computing Systems

  • Course Code: CS 439

  • Focus on fundamental principles of computing systems.


Disk Cache

  • A main memory buffer that stores most recently accessed disk sectors.

    • Cache organization: Comprised of blocks.

    • File block size considerations: Evaluate benefits of matching file block size with page size or using multiples of page sizes.

    • Access Method: Uses a hash table for O(1) access to disk sectors.

    • Cache Replacement Algorithm: Implementing Least Recently Used (LRU).

  • Memory competition: Disk cache contends for memory resources with user processes and the kernel.

    • Cache size may be variable, impacting the main memory list.


Cache Operation: Read

  • Read Operations:

    • Check if the sector is already in cache.

      • If present, copy data from cache.

      • If not present:

        • Locate a free cache block.

        • Use LRU order to replace if necessary:

          • If the chosen block is modified, write it back to disk prior to replacing it.

        • Schedule a read operation from the disk into the cache block.

        • Copy data from cache once read operation is complete.


Cache Operation: Write

  • Two primary write policies:

    • Write Through: Immediate write to disk scheduled.

    • Write Back (or write behind):

      • If the sector is in cache, write directly to it.

      • If not in cache, allocate a free frame similar to read operations and write to cache.


Data Structures

  • Essential data structures include:

    • Hash Table: For cache management.

    • Cache Blocks: Storage components for data.

    • Free Block List: List of unallocated blocks in cache.

    • LRU List: List managing the order for block replacement based on use.


Cache Block Bits

  • Block status indicators:

    • M: Modified

    • B: Busy (I/O operation pending)

    • S: Semaphore (for multithreaded kernel operations)

    • U: Used bit status.


Additional File System Structures

  • Support for File System Operations:

    • Global and per-process tracking of open files.

    • Concurrency control information is maintained for access management.

    • Support for seamless client access regardless of file location.

    • On-demand mounting of file systems is available.

    • Resource usage management: Implementing quotas to regulate usage.

    • Memory-mapped files: Allow for unconventional file access patterns.


Per-Process Open File Table

  • Each process receives an open file table:

    • Each entry tracks each open file and includes:

      • Current read/write pointers.

      • Access modes (read/write/append) to enforce restrictions.

      • Index for global open file table for accessing actual file details.


Global File Table

  • A table that keeps track of global file access:

    • Each open file has an entry including:

      • Location pointers (e.g. pointer to inode).

      • File information (e.g. text or binary).

      • Count of concurrently open processes.

      • Concurrency control details (e.g., locks).

      • File permissions and access rights.


Concurrency Control Information

  • Issues arising when multiple processes open the same file:

    • Possible conflicts include:

      • Read-write conflicts.

      • Write-write conflicts.

      • Write-read conflicts.


Solutions to Concurrency Issues

  • No action: Leaves synchronization up to applications.

  • Advisory Locks: Non-enforced locks that require process adherence.

    • Uses functions like lock/unlock and can introduce complexity.

  • Real Locks: Enforced by the file system to ensure safety:

    • Includes locking types and ranges related to read/write operations.

    • Enhances safety for independent process access but adds overhead and complexity.


Seamless File Access

  • Enables a namespace that spans multiple disks and machines.

    • Facilitates file system reorganization without user knowledge.

    • Adapts to adding more disk space or hardware efficiently.


File System Mounting

  • Concept of a mount point which integrates file systems into a unified namespace.


Logical Volumes

  • Abstraction layer over low-level devices, providing:

    • A view that eliminates direct device recognition.

    • Support for spanning across multiple disks.

    • Flexibility for disk size adjustment and replication for performance.


Virtual Node Layer

  • Layer that abstracts file access:

    • Connects network file systems with local disk representation.

    • Utilizes vnode instead of inodes for simplified access.


Quotas

  • Mechanisms to regulate and account for disk usage:

    • Examples observed in UNIX systems with limits placed on:

      • Number of files/user.

      • Disk space allocation/user.

    • Variants include soft and hard limits for control.


Quota Operation

  • Management of user account limits during sessions:

    • Soft limits may be exceeded temporarily with warnings.

    • Hard limits are absolute and cannot be exceeded.

    • Failure to adhere to limits can lead to account lockout.


Quota Implementation

  • Involves the Global Open File Table for access enforcement:

    • File entries track user quota details:

      • Soft and hard limits for files and sizes.

    • All file creation and appending operations are monitored against user quotas.


Memory-Mapped Files

  • Offers interface where files are mapped directly into user space:

    • Benefits:

      • Enhanced flexibility for complex data structures.

      • Improved performance by eliminating unnecessary interface crossings.

      • Reduced overhead for data sharing between processes.


Implementation Issues

  • Challenges arise when different interfaces interact with the same file:

    • Need for consistent updates across interfaces.

    • Handling of concurrent mappings and data consistency.

    • Locking strategies to manage access and synchronization.

    • Issues related to truncating files during mapping.


A Solution

  • Possible strategies to maintain consistency:

    • Utilizing a Process Page Table.

    • Implementation of a Hash Table for cache management.

    • Effective management of Cache Blocks.


Possible Restrictions

  • Considerations when mapping files:

    • File blocks should align with page boundaries for effective access.

    • Handling file adjustments without notifying process maps.

    • Allowing varied mapping modes (private/shared) for flexibility.

robot