CSE451 Notes for 5/21/03
Devon Kim
Silas Brazil

Topic:  Secondary Storage and Disk Structure Introduction
Point:	Secondary Storage is the larger, slower chunk of the memory hierarchy,
 and can also be virtualized.

**** VIEWING NOTES AND SUGGESTIONS ******
This page contains ascii graphics - please use a fixed width font, like Courier 
New, to view it. For the best viewing (or printing) experience, please view 
using a classic console font (ie. try using Lynx / Links or your favorite
Unix text editor).

ASCII art was found through Google search terms "ASCII" "art" and "download"
Original art was modified (heavily) to suit needs.

ASCII Generator was used in the making
of the graphs as well as the ubiquitous Microsoft Paint (XP).


-------------------------------------------------------------------------------------------------------------------------------------------------
--Quick review of class organization:

part 1: Processor Virtualization
part 2: Memory Virtualization
part 3: Storage Virtualization

-------------------------------------------------------------------------------------------------------------------------------------------------
--Secondary Storage Definition and Facts

Secondary storage refers to all mass storage persistent media (anything other 
than volatile main memory): CDs,magnetic disk, Flash.
Tertiary storage includes magnetic tape.

Every year, secondary storage capacity doubles for the same price (now about 
$0.25/Mb).
All secondary storage media share the same properties: they are persistent, and
 their price is much less than main 
mem, but access time is longer.

Graph of storage density (Mbits per square inch) from 1960 to present: the past 
40 years have improved density 
by a factor of 5 million

                                                                                                    
          M;                                                                 M                          
          M;                                                                ME                          
          M;                                                               M                           
          M;                                                              MM                            
          M;                                                            ZM                             
          M;                                                         MMM                              
 MB/in^2  M;                                                       MM                                
          M;                                                     MMM.                                 
          M;                                                 MMMM                                    
 (  log ) M;                                             HMMM                                       
 ( scale) M;                                        JMMMMJ                                          
          M;                                   NMMMMH                                               
          M;                            .MMMMMM;                                                    
          M;                      .MMMMMN                                                           
          M;                 2MMMMM                                                                 
          M;             mMMMK                                                                      
          M;          MMML                                                                          
          M;       MMM                                                                              
          M;     MM2                                                                                
          M;   YM                                                                                   
          M;  MM                                                                                    
          M  ML                                                                                     
          M MU                                                                                      
          MLM                                                                                       
          MM                                                                                        
          MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM                          
              1960                        year                           2000
               ^ 
               |
               |               Overall improvement: 5 MILLION X
               |                       
     (professor's sidenote: machines back then used HUGE, unwieldy, clunky disks)

-------------------------------------------------------------------------------------------------------------------------------------------------
--Memory Hierarchy:

Memory is distributed from the very small, fast volumes close to the CPU to the 
large, slow volumes far from the CPU.
Smaller memory is more expensive, has a smaller address space, is volatile, and
 is quickly accessible.  Larger memory 
is the opposite in every way.  Technological improvements naturally bring faster
 memory closer to the CPU in order to
improve performance by exploiting locality of reference.  Price also determines 
how much of the faster memory can be practically available, and so the more expensive
resources are placed close to CPU, where they will be used more often.

The memory hierarchy, with average access times:

Memory hierarchy:
                                                                 bigger       slower 
Access time    |===========|                 \                     |            |
      |        |           |                  \                    |            |
  1 cycle      | registers |                compiler manages       V            V
      |        |           |                  /
      |        |===========|                 / 
      |                |                        
      |        |=================|            \ 
      |        |                 |             \
 < 5 cycles    |    L1 cache     |              \
      |        |                 |          architecture manages
      |        |=================|              |
      |                |                        |
      |  .     |======================|         |
      |  .     |                      |         /
      |  .     |      L2 cache        |        /
      |  .     |                      |       /
      |  .     |======================|      /
      |  .             |
      |  .     |=============================|                  \
      |  .     |                             |                   \
  ~20 cycles   |       physical memory       |                    \
      |  .     |                             |                     \
      |  .     |=============================|                     |
      |  .             |                                           |
      |  .     |===================================|         operating system
      |  .     |                                   |            manages
      |  .     |        secondary storage          |               |
 ~1 M cycles   |(hard disks,  optical storage, etc)|               |
      |  .     |                                   |               |
      |  .     |===================================|               /
      |  .             |                                          /
      |  .     |===========================================|     /
      |        |             tertiary storage              |    /
   ~minutes    |       (tape storage - God save us)        |
   to days     |===========================================|


                                                                                          
-------------------------------------------------------------------------------------------------------------------------------------------------
--Magnetic Disk Structure

The hard drive is arranged as a stack of magnetic platters skewered on a spindle. 
 Each platter is double-sided and is
read/written by a magnetic head attached to a common armature.  Each side of each 
platter is concentrically divided into
 tracks, and each track is divided radially into sectors.  Each sector (aka 'block')
 contains some amount of bits.

The average hard drive contains 8-16 platters, a few thousand tracks per platter, 
and a variable (depending on radius) 
number of sectors per track.

A picture of the hard drive structure:



armature w/ read/write heads over and under each platter

     _.-----._
 |>=====|     -. platter 0
 || -_       _-
 ||   ~-----~  
 |>=====| <-----------------------underneath r/w head
 ||
 ||  _.-----._
 |>=====|     -. platter 1
 || -_       _-
 ||   ~-----~
 |>=====|
 ||
 ||  _.-----._
 |>=====|     -. platter 2
 || -_       _-
 ||   ~-----~  
 |>=====|
 ||
 ||  _.-----._
 |>=====|     -. platter 3
 || -_       _-
 ||   ~-----~
 ...

-------------------------------------------------------------------------------------------------------------------------------------------------
--Disk Address Virtualization

Information in a hard drive is internally address by sector, giving rise to the 
four-tuple internal address format:
{ side . platter# . track# . sector# }

The differences in hard drive internals between manufacturers, changes across 
technological improvements, and the general complexity of the internal addressing 
scheme motivate disk-addressing virtualization.
This virtualization scheme is simply achieved by linearly addressing sectors, and
 allowing the addressor to ignore all 
internal structure(other than the total number of sectors).  Thus the OS that 
requests a block of data from the disk may 
do so simply by referring to a unique block number.  


(Note: if you're using a font with funny dimensions, the following
 will look like an ellipse. Real disks are circles, not ellipses)

A disk platter:
                      ,,ggddY""""Ybbgg,,
                 ,agd""'       |      `""bg,
              ,gdP"  sector    | sector   "Ybg,
            ,dP"\       11     |     10    / "Yb,
          ,dP"   \     _,,ddP"""Ybb,,_    /    "Yb,
         ,8"      \  ,dP"'         `"Yb, /       "8,
        ,8' sector ,d"  \  sector 3 /  "b,  sector`8,
       ,8'    12  d"     \         /     "b     9  `8,
       d'        d'sector \,gPPRg,/sector `b        `b
       8         8    4   dP'   `Yb      2 8         8
       8---------8--------8)  O  (8--------8---------8
       8         8 sector Yb     dP sector 8         8
       8         Y,    5  /"8ggg8"\   1   ,P         8
       Y, sector  Ya     /         \     aP  sector ,P
       `8,    13   "Ya  / (track 0) \  aP"     7   ,8'
        `8,        / "Yb,_ sector 0_,dP"\         ,8'
         `8a      /    `""YbbgggddP""'   \       a8'
          `Yba   / sector     |    sector \    adP'
            "Yba/    14   (track 1)  6     \ adY"
              `"Yba,          |          ,adP"'
                 `"Y8ba,      |      ,ad8P"'
                      ``""YYbaaadPP""''


-------------------------------------------------------------------------------------------------------------------------------------------------
--Disk Access Time Definitions

*     "Internal Disk Transfer Time", usually about 1ms
 The amount of time needed to collect a block (sector) of data *that is already 
under the read/write head*.  (This could be multiple sectors if the request was
large, but to be useful as a metric, Internal Disk Transfer Time would need to 
be expressed as time per constant amount of data.)

*     "Rotational Latency" =  on average 0.5 * 1/rotation_speed, usually about 
5-10msec
An issue when the requested sector is not under the read/write head, but the 
read/write head is on the correct track.
num_sectors is the number of sectors that must be passed by to read the requested 
sector that is not under the head.

*     "Seek Time", usually about 10-30ms
The time required to move the read/write head when it it not on the requested 
track.

-------------------------------------------------------------------------------------------------------------------------------------------------
--General Design Issues

*    Power Consumption:
More power to the motors increases disk access speed, but this is a limitation 
in portable devices.
Several methods of motor powering:
-Outlet: roughly 7200 - 15K rpm, with a seek time less than 10ms
-Internal Battery:  3600 rpm, average seek time of 50ms

*Density:
Each bit in a sector is measured by a rectangular width and height.  The mechanical
 engineers reduce the height by improving the precision of the read/write heads 
(narrowing the track width), while physicists work on reducing the width (by improving
 the sensitivity of the read/write heads).



                      ,,ggddY""""Ybbgg,,
                 ,agd""'      ^       `""bg,
              ,gdP" \       Height      / "Ybg,      better through
            ,dP"     \        v    ----/------------ higher granularity of
          ,dP"        \_,,ddP"""Ybb,,_/        "Yb,  head movements
         ,8"         ,dP"'    ^    `"Yb,         "8,
        ,8'        ,d" <----Width----> ------------------- better 
       ,8'        d"                     "b        `8,     with physics
       d'        d'        ,gPPRg,        `b        `b     & bigger sectors
       8         8        dP'   `Yb        8         8
       8         8        8)  O  (8        8         8
       8         8        Yb     dP        8         8
       8         Y,        "8ggg8"        ,P         8
       Y,         Ya                     aP         ,P
       `8,         "Ya                 aP"         ,8'
        `8,          "Yb,_         _,dP"          ,8'
         `8a           `""YbbgggddP""'           a8'
          `Yba                                 adP'
            "Yba                             adY"
              `"Yba,                     ,adP"'
                 `"Y8ba,             ,ad8P"'
                      ``""YYbaaadPP""''



-------------------------------------------------------------------------------------------------------------------------------------------------
--For Next Lecture:

Bigger sectors allow for better error correction...