notes19b

Blocking uses spatial locality when a location is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: • Caching (Uses temporal locality)  When a location is accessed, bring it closer to memory  If accessed again, it will be faster. • Blocking (Uses spatial locality)  When a location is accessed, bring its neighbor close to the CPU  If a neighbor is accessed, it will be faster Note: since there is a limit to how many blocks can fit into primary ­level memory (Virtual Memory) We may have to swap blocks as the program proceeds. How to choose which to remove? Algorithms can be designed to limit the number of block swaps needed  ­> B ­Tree B ­Tree (of degree d)  ­ Balanced: all leaves are at same level  ­ Each internal node has (for odd d): !    ­ Between | ! | to d ­1 keys One more child than number of keys. Keys in a node are kept in increasing order 4 Keys c in the left most subtree: c < k1  Eg: 7 < 10 Keys c in the right most subtree: c > km  Eg: 68 > 50 Keys c in the subtree s: ks ­1 < c < ks  Eg: 10 < 44 < 50 Searching in a B ­Tree  ­ Start at root  ­ Search keys at root  target == one of the keys at root,  ­> Done  if not, locate...
View Full Document

This note was uploaded on 02/04/2014 for the course CS 234 taught by Professor Baranoski during the Spring '09 term at Waterloo.

Ask a homework question - tutors are online