Ch02 Storage Media

Embed Size (px)

Citation preview

  • 8/4/2019 Ch02 Storage Media

    1/24

    SistemSistem Basis DataBasis Data

    CSCS33343334

    Storage Media

    1

    Fakultas Informatika ITTelkom2010

  • 8/4/2019 Ch02 Storage Media

    2/24

    Disks, Memory, Files

    Query Optimizationand Execution

    Relational Operators

    The BIG picture

    www.ittelkom.ac.id 2

    Files and Access Methods

    Buffer Management

    Disk Space Management

    DB

  • 8/4/2019 Ch02 Storage Media

    3/24

    Disks and Files

    DBMS stores information on disks.

    In an electronic world, disks are a mechanicalanachronism!

    www.ittelkom.ac.id

    READ: transfer data from disk to main memory(RAM).

    WRITE: transfer data from RAM to disk. Both are high-cost operations, relative to in-memory

    operations, so must be planned carefully!

    3

  • 8/4/2019 Ch02 Storage Media

    4/24

    Data Storage

    Deal with very large amounts of dataefficiently. How does a computer system store and

    www.ittelkom.ac.id

    What representations and data structures bestsupport efficient manipulations of the data?

  • 8/4/2019 Ch02 Storage Media

    5/24

    Why Not Store Everything in Main

    Memory?

    Costs too much.

    Main memory is volatile.

    www.ittelkom.ac.id

    .

    5

  • 8/4/2019 Ch02 Storage Media

    6/24

    File System

    Why not using file system?

    Can be used to store data information for a long period as well.Consistency and failure recovery capability

    Problems:

    www.ittelkom.ac.id

    no query language, no efficient access for a data itemsupport of the creation of database is limitedconsistency control is not adequate

    Management of Data is complex

  • 8/4/2019 Ch02 Storage Media

    7/24

    Smaller, FasterPrimary Storage/Main Memory

    Internal storage For currenly used data

    Cache, main memory

    The Storage Hierarchy

    www.ittelkom.ac.idSource: Operating Systems Concepts 5th Edition

    Bigger, Slower

    econ ary s orage Disk for the main database Electronic Disk, Magnetic disk

    Tertiary Storage Tapes for archiving older

    Versions of the data

    Optical Disk, Magnetic Tape

    7

  • 8/4/2019 Ch02 Storage Media

    8/24

    Storage Classification

    Volatile storage

    Loses contents when power is switched off Cache, Main memory

    www.ittelkom.ac.id

    Non-volatile storage Contents persist even when power is switched off Includes secondary and tertiary storage

    8

  • 8/4/2019 Ch02 Storage Media

    9/24

    Primary Storage

    Cache fastest and most costly form of storage; volatile; managed

    by the computer system hardware.

    www.ittelkom.ac.id

    Main memory: fast access generally too small (or too expensive) to store the entire

    database

    Volatile contents of main memory are usually lost if apower failure or system crash occurs.

    9

  • 8/4/2019 Ch02 Storage Media

    10/24

    Primary Storage

    Input Storage Area

    To store data input Program Storage area

    Store instructions to mana e data

    www.ittelkom.ac.id

    Working Storage Area To process data

    Output Storage Area

    To store data temporally before output to user

    10

  • 8/4/2019 Ch02 Storage Media

    11/24

    Primary Storage

    CONTROL UNIT SECTION

    INPUT

    STORAGE

    AREA

    PROGRAM

    STORAGE AREA OUTPUT

    STORAGE

    AREA

    CONTROL UNIT SECTION

    PROGRAM

    STORAGE AREA

    OUTPUTINPUT

    PRIMARY

    STORAGE SECTION

    www.ittelkom.ac.id 11

    ARITHMETIKA LOGICAL UNIT SECTION

    WORKING

    STORAGE AREA

    STORAGEAREA

    WORKING

    STORAGE AREA

    ARITHMETIKA LOGICAL UNIT SECTION

    STORAGEAREA

    Control unit section, Primary storage section, ALU section

    Is part of CPU.

  • 8/4/2019 Ch02 Storage Media

    12/24

    Electric Disk Non-Volatile

    Data can be written at a location only once, but location can be erasedand written to again

    Widely used in embedded devices such as digital cameras

    Is a type of EEPROM (Electrically Erasable Programmable Read-OnlyMemory)

    Secondary Storage

    www.ittelkom.ac.id

    Magnetic-disk Data is stored on spinning disk, read/written magnetically

    Data must be moved from disk to main memory for access, and writtenback for storage

    direct-access possible to read data on disk in any order,

    Much larger capacity

    Survives power failures and system crashes

    disk failure can destroy data, but is rare

    12

  • 8/4/2019 Ch02 Storage Media

    13/24

    Terms Used in the Hardware

    Description

    Sector - A segment or arc of a track.

    Block - is the division of a track into equal sized portionsby the operating system. Interblock Gaps - These are fixed sized segments that

    www.ittelkom.ac.id

    separate t e oc s. Read/Write Head - Actual reads/writes the information tothe disk.

    Cylinder - Tracks with the same diameter that are locatedon the disk surface of a disk pack.

    13

  • 8/4/2019 Ch02 Storage Media

    14/24

    Tertiary Storage

    Optical storage

    non-volatile, data is read optically from a spinning disk using a laser CD-ROM and DVD

    Write-one, read-many (WORM) optical disks used for archivalstorage (CD-R, DVD-R, DVD+R)

    www.ittelkom.ac.id

    - , - , ,

    and DVD-RAM)

    Tape storage non-volatile, used primarily for backup (to recover from disk failure),

    and for archival data sequential-access much slower than disk

    very high capacity

    14

  • 8/4/2019 Ch02 Storage Media

    15/24

    Components of a Disk

    The platters spin

    The arm assembly ismoved in or out toposition a head on a

    www.ittelkom.ac.id

    es re rac .

    Tracks under heads

    make a cylinder

    Only one head reads/writes

    at any one time.

    Block sizeis a multipleof sector size

    (which is fixed).15

  • 8/4/2019 Ch02 Storage Media

    16/24

    Accessing a Disk Page

    Time to access (read/write) a disk block:

    seek time(moving arms to position disk head on track) rotational delay(waiting for block to rotate under head) transfer time(actually moving data to/from disk surface)

    www.ittelkom.ac.id

    .

    Seek time varies between about 0.3 and 10msec Rotational delay varies from 0 to 4msec Transfer rate around .08msec per 8K block

    Key to lower I/O cost: reduce seek/rotation delays!Hardware vs. software solutions?

    16

  • 8/4/2019 Ch02 Storage Media

    17/24

    Arranging Pages on Disk

    `Next block concept:

    blocks on same track, followed by blocks on same cylinder, followed by blocks on adjacent cylinder

    www.ittelkom.ac.id

    on disk (by `next), to minimize seek androtational delay.

    For a sequential scan, pre-fetchingseveral pagesat a time is a big win!

    17

  • 8/4/2019 Ch02 Storage Media

    18/24

    Performance Measures of Disks

    Access timethe time it takes from when a read or write request is issued to when data transferbegins.

    Seek time time it takes to reposition the arm over the correct track. Rotational latency time it takes for the sector to be accessed to appear under

    the head.

    -

    www.ittelkom.ac.id

    the rate at which data can be retrieved from or stored to the disk. 25 to 100 MB per second max rate, lower for inner tracks Multiple disks may share a controller, so rate that controller can handle is also

    important E.g. ATA-5: 66 MB/sec, SATA: 150 MB/sec, Ultra 320 SCSI: 320 MB/s

    Fiber Channel (FC2Gb): 256 MB/s Transfer Rate (tr)

    The rate at which information can be transferred to or from the disk.

    Block Transfer Time (btt)

    The time it takes to transfer the data once the read/write head has been positioned.18

  • 8/4/2019 Ch02 Storage Media

    19/24

    Disk Parameters

    parameter typical value source

    T track size 50 KB fixedB block size 1 KB formatted

    s seek time 10 msec fixed

    www.ittelkom.ac.id

    p rotational velocity 1,000 rps fixedrd (average) rotational delay 3 msec .5*(1/p)

    tr transfer rate 1MB/sec T*pbtt block transfer time 1 msec B/trrbtt random block transfer time 13 msec s + rd + bttcbtt contiguous block transfer time 1 msec B/tr

  • 8/4/2019 Ch02 Storage Media

    20/24

    Parallelizing Disk Access Using RAID

    RAID - Stands for Redundant Arrays of InexpensiveDisks or Redundant Arrays of Independent Disks.

    www.ittelkom.ac.id

    RAIDs are used to provide increased reliability,increased performance or both.

    20

  • 8/4/2019 Ch02 Storage Media

    21/24

    RAID Levels

    Level 0 - has no redundancy and the best writeperformance but its read performance is not as good as

    level 1.

    Level 1 - uses mirrored disks which provide redundancyand improved read performance.

    www.ittelkom.ac.id 21

  • 8/4/2019 Ch02 Storage Media

    22/24

    RAID Levels

    Level 2 - provides redundancy using Hamming Codes

    Level 3 - uses a single parity disk.

    www.ittelkom.ac.id 22

  • 8/4/2019 Ch02 Storage Media

    23/24

    RAID Levels

    Level 4 and 5 - use block-level data striping with level 5distributing the data across all the disks.

    Level 6 - uses the P + Q redundancy scheme makinguse of the Reed-Soloman codes to protect against thefailure of 2 Disks.

    www.ittelkom.ac.id 23

  • 8/4/2019 Ch02 Storage Media

    24/24

    TERIMA KASIH

    www.ittelkom.ac.id