13 April 2008 1
Content Addressable Memory Using B-Tree Jack Dennis MIT Computer - - PowerPoint PPT Presentation
Content Addressable Memory Using B-Tree Jack Dennis MIT Computer - - PowerPoint PPT Presentation
Content Addressable Memory Using B-Tree Jack Dennis MIT Computer Science and Artificial Intelligence Laboratory 13 April 2008 1 Multi-Thread, Multi-Core Chip Instr Association Data Association Thread Scheduler CAM CAM MTP MTP MTP
13 April 2008 2
Multi-Thread, Multi-Core Chip
IAU
Instruction Access Net
Shared Memory System Interface IAU DAU DAU
Data Access Net
MTP MTP MTP MTP
Data Association CAM Thread Scheduler Instr Association CAM
13 April 2008 3
Data Structures: The Heap as a DAG
- Fan-out as large as 16
Leaf Chunks Root Chunk
- Three levels yields 4096
elements (longs)
- Cycle-Free Heap
- Arrays as Trees
13 April 2008 4
B-Trees
A Data Structure that represents a collection of keys In an Order Z B-Tree, each node holds at least Z keys and associated pointers to subtrees. An order Z B-Tree of depth h can hold at least (Zh * 2) – 1 keys
13 April 2008 5
A B-Tree Node
Invariants (Order Z B-Tree; Z = 8 above):
ki k15 k0
k < k0 ki > k > ki+1 k > k15
ki+1 p0 pi p16
- -
- -
Number of keys at a node: at least Z; at most Z*2 Exception: The root node may contain as few as zero keys. All subtree pointers in a leaf node are null (and only those) All leaf nodes are at the same level.
13 April 2008 6
A Hardware B-Tree CAM
stunt box pointers compare keys > = < pointer to next node pointer index [0..16] pointers compare keys > = < M15 pointers M16 key M0 M U X match
13 April 2008 7
Insert
- 1. Search the B-Tree for the new key; failure if
found.
- 2. If the leaf node is full it must be split into two
nodes, each holding Z keys. The median key of the set of keys held by the found leaf node and the key to be inserted is inserted into the parent node, continuing up the tree.
- 3. To do insert in a single pass, split any full node
encountered during the search to anticipate the need.
13 April 2008 8
Delete
- 1. Search the B-Tree for the given key; failure if
not found.
- 2. To do delete a key from a leaf node, it may be
necessary to move in a key from a neighboring node; if this is not possible, the leaf node may be joined with one of its neighbors and the pointer to the lost node deleted from the parent
- 3. A few more complications arise.
13 April 2008 9
B-Tree Node Rearrangement
pointers keys pointers keys M15 pointers M16 M0 pointers keys M15 M0 Switch Split/Join read write pointers keys pointers M16 new key, pointer