Docsity

File Management Two - Operating Systems - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download File Management Two - Operating Systems - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Operating Systems

Lecture 27 (wow, we made it!):

File Management

The Big Picture, Again

Review: Disk Geometry

  • Disks consist of platters, each with two surfaces.
  • Each surface consists of concentric rings called tracks.
  • Each track consists of sectors separated by gaps.

spindle

surface

tracks track k

sectors

gaps

Blocks and records

• Records are the logical unit of access of a

structured file

• Blocks are the unit of I/O on secondary storage

• For I/O to be performed, records must be

organized as blocks

Fixed Blocking

  • Fixed-length records are used, and an integral number of records are stored in a block.
  • Unused space at the end of a block is internal fragmentation

Variable Length Spanned Blocking

  • Variable-length records are used and are packed into blocks with no unused space.
  • Some records may span multiple blocks
    • Continuation is indicated by a pointer to the successor block

The Big Picture, Again

Secondary Storage Management

  • The Operating System is responsible for allocating

blocks to files

  • Two related issues
    • How to allocate space to files?
    • How to keep track of the space available (unused)?

Preallocation

• Need the maximum size for the file at the time

of creation

• Difficult to reliably estimate the maximum

potential size of the file

• Tend to overestimated file size so as not to run

out of space

• Alternative: Dynamic Allocation

Portion size

• Two extremes:

  • Portion large enough to hold entire file is allocated
  • Allocate space one block at a time

• Trade-off between efficiency from the point of

view of a single file, or the overall system

efficiency

Contiguous

File Allocation

  • Single set of blocks

allocated at the time

of file creation

  • Simple file allocation

table

  • External

fragmentation

  • Each block contains a pointer to the next block in the chain
  • Only single entry in the file allocation table - Starting block and length of file
  • No external fragmentation
  • How many disk accesses for reading the 100,000 th^ byte?

Chained Allocation

(linked lists)

Indexed allocation

with Block Portions

  • File allocation table has a pointer to an index for each file
  • The index has one entry for each portion allocated to the file
  • Allocation may be either
    • Fixed size blocks or
    • Variable sized blocks

Indexed Allocation with

Variable Length Portions