BTrees-fall2010

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

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

Other time considerations Source: Simon Garrett Modifications by Evan Korth

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

View Full Document
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 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.

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

View Full Document
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

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

View Full Document
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 m / 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern