Chapter 01

9
 Chapt er 1 - 1 File Structures Cha pter 1 - 1   M.Folk and B.Zoellick, File Structures, Addison Wesley.  E. Horowitz, S. Sahni, and S. Anderson-Freed, Fundamentals of Data Structures in C , Computer Science Press.

description

File Structures File Structures File Structures File Structures

Transcript of Chapter 01

  • Chapter 1 - 1

    OF fjj b

    File Structures

    Chapter 1 - 1OF fjj b

    z M.Folk and B.Zoellick, File Structures, Addison Wesley.z E. Horowitz, S. Sahni, and S. Anderson-Freed,

    Fundamentals of Data Structures in C, Computer Science Press.

  • Chapter 1 - 2

    Chapter 1 - 2OF fjj b

    z File Structures + Advanced Data StructuresFile File, I/O Processing, Access MethodExternal SortingIndexing

    Hashing, Heap Structures Search Structures: AVL Tree, 2-3 Trees, B-Tree,

    z Not IncludesDynamic Programming, Divide-And-ConquerNP-Hard and NP-Complete Problems,

    Chapter 1 - 3OF fjj b

    &168

    Hashing (2)15External Sorting(2)7Hashing (1)14External Sorting(1)6B-Tree (3)13Field, Record, Page5B-Tree (2)12Buffering, Blocking4Red-Black Tree, B-Tree (1)11Storage Device3AVL Tree, 2-3, 2-3-410File System Call2

    IndexingNF9rN:'1

  • Chapter 1 - 3

    Chapter 1 - 4OF fjj b

    Chapter 1

    Introduction to FileStructures

    Chapter 1 - 5OF fjj b

    1. The Heart of File Structure Designz Motivation

    Disks are slow. RAM : 120 nanoseconds Disk : 10 ~ 30 milliseconds

    Disk Enormous capacity at much less cost than RAM Non-volatile storage device

    z GoalAccessing to all the capacity without making ourapplications spend a lot of time waiting for the disk

  • Chapter 1 - 4

    Chapter 1 - 6OF fjj b

    2. A Short History of File Structure Design

    z General goal of research in file structures

    One access to the disk. Ideal Only two or three trips to the disk. Practical Grouping information for fewer trips

    File ( File )

    Chapter 1 - 7OF fjj b

    z History Sequential file in tape device Direct access of disk using index Simple index ( sequentially stored ) Tree structured index

    Binary search tree, AVL tree B-tree, B+-tree: logkN access

    Hashing Extendible, dynamic hashing Multi-key access method Spatial access method: R-tree, K-D-B tree

  • Chapter 1 - 5

    Chapter 1 - 8OF fjj b

    3. A Conceptual Toolkit: File Structure Literacy

    z File structure Sequential Access Method Indexed Sequential Access Method Direct Access Method

    z Disk I/O Buffering Blocking Bucket Concept Splitting & Merging

    Chapter 1 - 9OF fjj b

    z

    package

  • Chapter 1 - 6

    Chapter 1 - 10OF fjj b

    4.

    z

    ,

    z

    , ,

    z

    Chapter 1 - 11OF fjj b

    z

    , ,

    z

    , , , , ,

    z

    //

  • Chapter 1 - 7

    Chapter 1 - 12OF fjj b

    2~J 2~ 2~

    [ 1.1] BjJr

    2~J

    .

    b

    [ 1.2] &JrJ

    ~. jz 2~J

    .

    [ 1.3] .&JrJ

    Chapter 1 - 13OF fjj b

    2~J

    j:

    j:

    [ 1.4] 2~z&&JrJ

    Inventory Master File Maintenance Audit Listing Page1

    Update Product Quantity Quantity ReorderCode Code On Hand On Order Point ------ACTION------

    A DR1112 400 50 400 AdditionC DR2000 350 Change -- Qty on handA DR3814 239 0 200 AdditionA DR3914 150 0 50 AdditionD DR4000 DeletionC GR5000 100 Change -- Qty on orderC GR5014 45 Change -- Reorder pointA SA3012 100 25 110 AdditionC SA4310 125 Change -- Qty on hand

    [ 1.5] NN

  • Chapter 1 - 8

    Chapter 1 - 14OF fjj b

    Inventory Master File Maintenance Error Listing Page1

    Update Product Quantity Quantity ReorderCode Code On Hand On Order Point ------ERROR MESSAGE------

    D DR3000 Invalid Delete -- Master Not On FileC GR5013 100 Invalid Change -- Master Not On FileA HM1032 125 0 75 Invalid Add -- Master Already On FileX HM1308 Invalid Update codeY SA3014 Invalid Update codeA SA4201 50 0 30 Invalid Add -- Master Already On FileD SD1103 Invalid Delete -- Master Not On File

    [ 1.6] N

    Chapter 1 - 15OF fjj b

    Inventory Master File Listing Page1

    Product Quantity Quantity ReorderCode On Hand On Order Point

    DR1015 25 0 30DR1112 400 50 400DR2000 350 25 375DR3814 239 0 200DR3914 150 0 50GR2001 74 10 80GR3034 25 10 30GR5000 500 100 525GR5014 45 0 45HM1032 123 0 120HM1308 75 0 102SA3012 100 25 110SA4201 50 0 30SA4310 125 0 100SA5012 3 0 5

    [ 1.7] &JrN

  • Chapter 1 - 9

    Chapter 1 - 16OF fjj b

    Inventory Master File Listing of Records With Page 1Quantity On Hand BELOW Recorder Point

    Product Quantity Quantity ReorderCode On Hand On Order Point

    DR1015 25 0 30HM1308 75 0 120SA5012 3 0 5

    [ 1.8] &JrRsN

    Chapter 1 - 17OF fjj b

    Transactions Read 578Adds 461

    Processed 446Invalid 15

    Changes 87Processed 79Invalid 8

    Invalid Update Codes 1Master Records Read 28,406Master Records Written 28,825

    [ 1.9] JrN