BTrees-fall2010

BTrees-fall2010 - Other time considerations Source: Simon...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: Other time considerations Source: Simon Garrett Modifications by Evan Korth 2 Disk access time vs CPU time • We have assumed that all instructions are created equally in our analysis all semester. What if this assumption is not true? • One example: – It could be the case that our data does not fit in memory. – In that case we need to access the secondary storage (disk) 3 A closer look at disk access • A couple of years ago I purchased the components I need to build a home computer. My 750g drive spins at 7200RPM and my Intel Core2 Duo runs at 2.4 Ghz • 7200 rpm means 7200 revolutions per minute or one revolution every 1/120 of a second (8.3ms) • On average what we want is half way round this disk – it will take ~4ms. – Note I am assuming the read arm is in the correct position • This sounds good until you realize that we get 240 disk accesses a second – the same time as 2.4 billion instructions (2.4 Ghz) • In other words, one disk access takes about the same time as 10,000,000 instructions • Not all instructions can be considered equal! Note: processor speeds tend to improve at a quicker rate than Note: processor speeds tend to improve at a quicker rate than disk speeds so the cost of a disk access becomes even more disk speeds so the cost of a disk access becomes even more expensive as related to CPU instructions over time. expensive as related to CPU instructions over time. 4 Solution • Assume that we use an AVL tree to store all the car driver details in NYC (about 20 million records) • Assume further that each node in the tree must be retrieved from the disk. • We still end up with a very deep tree with lots of different disk accesses; log 2 20,000,000 is about 24, so this takes about 0.1 seconds (if there is only one user of the program) • We know we can’t improve on the log n for a binary tree • But, the solution is to use more branches and thus less height! • As branching increases, depth decreases B-trees 6 Definition of a B-tree • A B-tree of order m is an m-way tree (i.e., a tree where each node may have up to m children) in which: 1. the number of keys in each non-leaf node is one less than the number of its children and these keys partition the keys in the children in the fashion of a search tree 2. all leaves are on the same level 3. all non-leaf nodes except the root have at least 3....
View Full Document

This note was uploaded on 05/06/2010 for the course COMPUTER S 101 taught by Professor Sanaodeh during the Spring '08 term at NYU.

Page1 / 27

BTrees-fall2010 - Other time considerations Source: Simon...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online