Architecture of a hard disk  

  • Architecture of a hard disk:

    • Mulltiple rotating platters (coated with magnetic material)
    • Moving disk heads that read/write platter surfice
    • Each read/write operation reads/write one sector of the disk

  Structure of a platter  

  • Top view of a platter:

    • A disk platter contains many circular tracks (magnetic strips)

    • Each track is divided into many sectors by gaps

    • Each read/write operation will read/write one sector (for efficiency reason)

  Terminology: "cylinder"  

  • Cylinder = all tracks at same distance from center of the hard disk

    • Disk heads move in unison

      • I.e.: all disk heads will be on the same cylinder

    • Related data are stored in the same cylinder for efficiency

  Disk block  

  • Disk block = a logical group of sectors (defined by software) that are read/written collectively (= together)

    Sector of a disk Disk block

  • One disk block today is about 8 - 64 Kbytes

  • A disk (read/write) operation will always access one disk block (for efficiency)

  How to read/write a hard disk  

  • Watch how a hard disk is read/written:

    • Mulltiple rotating platters (coated with magnetic material)

    • Moving disk heads that read/write platter surfice

    • Each read/write operation reads/write one disk block

    • A disk block consists of multiple sectors (located on the same track)

  Data file (or file for short)  

  • File = a (logical) unit on a computer system used to store data


  • A file consists of:

    • A list of (data) blocks


  • The list of (data) block of a file is stored in a directory entry

    The structure of a directory entry consists of:

                                           block numbers
                                         <------------------->
         +-----------+-------------------+-+-+-+-+-+ ...... +-+
         | Filename  | owner/access info | | | | | |        | |
         +-----------+-------------------+-+-+-+-+-+ ...... +-+            
      


  • The directory entries are stored in the directory on the disk

  File directory (or directory for short)  

  • Directory:

    • The directory is stored in special reserved blocks/tracks called:

      • Directory blocks/tracks

    The File Directory is locate on special reserved tracks on the disk (OS dependent)

  How to find the disk blocks of a data file (on disk)  

  • To access a data file (= all its data blocks), you start with its file name

  • Read the disk directory and find the directory entry that contains the filename:

    Result: we have the list of data block of the file

       +-----------+-------------------+--+--+-+-+-+ ...... +-+
       | Filename  | owner/access info |b1|b2| | | |        | |
       +-----------+-------------------+--+--+-+-+-+ ...... +-+     
    

  Steps to access a data block on disk - step 1: move disk head to cylinder  

    (1) Move the disk heads to the desired cylinder

    Time to move the disk head to a cylinder is called:

    • seek time ------ (typical seek time is ~ 0 - 10 msec)

  Steps to access a data block on disk - step 2: wait for sector  

    (2) Wait for the desired sector to arrive under the disk head

    Time to wait for the sector to arrive is called:

    • rotational delay ------ (typical delay time is ~ 0 - 10 msec)

  Steps to access a data block on disk - step 3: transfer the data  

    (3) Transfer the data from sector to main memory (through the disk controller)

    Time to read/write data from/to a sector is called:

    • transfer time ------ (typical transfer time is < 1 msec)

  Disk sector access time (delay)  

  • Disk access time (delay)  =   seek time  +  rotational delay  +   transfer time

  • Typical values of disk access time for a random sector is:

    • 1 - 20 msec


  • Strategy to improve access time of disk accesses:

    • Place related sectors close to each other

  • Consequences:

    • Seek time for the next sector (in disk block) is reduced

    • Rotational delay for the next sector (in disk block) is also reduced

      • If the next sector is placed physically "after" the previous sector in disk block

  Access time of "next" sector using optimized sector placement strategy  

  • Typically access time for the "next" sector using a strategic sector placement strategy:

    • Seek time = 0

             (Unless the next sector is located on a different cylinder)

    • Rotational delay ~= 0

             (Unless the next sector is located on a different cylinder)

    • Transfer time unchange (< 1 msec)


  • Conclusion:

    • Store related data that are used together on nearby sectors

      (Sectors of one blocks are always stored near each other)