Definition:

File locking:

  • Similar to read-write lock
    • Shared lock: for all of its readers, many resources can acquire concurrently
    • Exclusive lock: for a writer at a time
  • Mandatory vs advisory:
    • Mandatory: access is denied depending on locks held and requested
    • Advisory: processes can find status of lock and decice what to do

File Access methods:

  • Sequential access:
    • Read block by block
    • operations:
      • read/write next block (1 after the other)
      • reset (move back to beginning of the file)
    • after write a block, cant read but have to reset (cant read backward)
  • Direct access:
    • operations:
      • read, write next n blocks
      • position to n
      • read/write next
      • rewrite next n blocks
  • Indexed access:
    • use index table to directly go to the file location on disk

File allocation on disk:

  • Contiguous:
    • Each file oocupies a set of continuous blocks
    • gud:
      • best performance
      • simple, When read, only need to know starting block and nb of blocks
    • Problems:
      • hard to determine the size before write
      • external fragmentation
      • file cant extend dynamically, need to relocate then extend
  • Extent-based contiguous:
    • a file consits of 1 or more extents
    • each extent is a set of continuous blocks
  • Linked:
    • a file has block id of start and end block
    • a block has pointer to another block, or nil
    • free space management system is called when new block is needed
    • gud:
      • fast when read sequential
      • No external fragmentation
  • Indexed:
    • A file points to index blocks (a normal block) that contains pointers to other data blocks
    • problems:
      • requires more reads for index blocks
  • Unix’s Index Node with File Link
    • has direct blocks pointers that point to other blocks
    • single indirect blocks pointers that point to index block (then point to other block)
    • double indirect blocks that point to block that point to index block