13 A: External Algorithms; Disjoint Sets; Java API cs1102s/slides/slides_13_A.color.pdf  External

  • View
    213

  • Download
    0

Embed Size (px)

Text of 13 A: External Algorithms; Disjoint Sets; Java API cs1102s/slides/slides_13_A.color.pdf ...

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    13 A: External Algorithms; Disjoint Sets; JavaAPI Support

    CS1102S: Data Structures and Algorithms

    Martin Henz

    April 14, 2010

    Generated on Wednesday 14th April, 2010, 10:00CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support1

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    1 External Search Trees: B-Trees

    2 External Sorting

    3 Disjoint Sets

    4 Java API Support for Data Structures

    5 Another Puzzler

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support2

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    1 External Search Trees: B-TreesMotivationDefinition of B-TreesInsertion and Deletion

    2 External Sorting

    3 Disjoint Sets

    4 Java API Support for Data Structures

    5 Another Puzzler

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support3

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Internal Storage

    Assumption so far: random-access memory

    Memory can be read and written at a speed O(1)

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support4

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Internal Storage

    Assumption so far: random-access memory

    Memory can be read and written at a speed O(1)

    Abstraction

    Even for main memory accessible to the CPU through a fastdata bus, this is a coarse simplification

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support5

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Internal Storage

    Assumption so far: random-access memory

    Memory can be read and written at a speed O(1)

    Abstraction

    Even for main memory accessible to the CPU through a fastdata bus, this is a coarse simplification

    Complicating factors

    very fast memory on the CPU: registers

    cache hierarchy: layers of larger and slower memory unitsbetween CPU and main memory chips

    virtual memory: disk memory used when required memoryexceeds physically available main memory

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support6

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support7

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support8

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    Disk storage

    Access time depends on speed of disk, e.g. 7,200 RPM

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support9

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    Disk storage

    Access time depends on speed of disk, e.g. 7,200 RPM

    How many disk accesses possible per second?

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support10

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    Disk storage

    Access time depends on speed of disk, e.g. 7,200 RPM

    How many disk accesses possible per second?

    120 accesses per second

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support11

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    Disk storage

    Access time depends on speed of disk, e.g. 7,200 RPM

    How many disk accesses possible per second?

    120 accesses per second

    How many instructions are executed per minute?

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support12

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    Disk storage

    Access time depends on speed of disk, e.g. 7,200 RPM

    How many disk accesses possible per second?

    120 accesses per second

    How many instructions are executed per minute?

    With 1.2-GIPS processor, we have 1,2 billion instructions persecond,

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support13

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    External Storage

    Internal vs external storage

    Internal storage is governed by electricity;external storage is governed by mechanics

    Disk storage

    Access time depends on speed of disk, e.g. 7,200 RPM

    How many disk accesses possible per second?

    120 accesses per second

    How many instructions are executed per minute?

    With 1.2-GIPS processor, we have 1,2 billion instructions persecond, a factor of 10,000,000 faster than disks!

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support14

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Another Characteristics of Disk Storage

    We know already

    Access time is limited by mechanics

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support15

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Another Characteristics of Disk Storage

    We know already

    Access time is limited by mechanics

    How about access size?

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support16

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Another Characteristics of Disk Storage

    We know already

    Access time is limited by mechanics

    How about access size?

    defined by operating system/hardware design;

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support17

  • External Search Trees: B-TreesExternal Sorting

    Disjoint SetsJava API Support for Data Structures

    Another Puzzler

    MotivationDefinition of B-TreesInsertion and Deletion

    Another Characteristics of Disk Storage

    We know already

    Access time is limited by mechanics

    How about access size?

    defined by operating system/hardware design;typically large chunks, called blocks, of data can be read veryfast, once the disk head has reached the correct location

    CS1102S: Data Structures and Algorithms 13 A: External Algorithms; Disjoint Sets; Java API Support18

  • External Search Trees: B-TreesExternal Sorting

    Dis