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

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

View Full Document Right Arrow Icon
Other time considerations Source: Simon Garrett Modifications by Evan Korth
Image of page 1

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

View Full Document Right Arrow Icon
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)
Image of page 2
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.
Image of page 3

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

View Full Document Right Arrow Icon
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
Image of page 4
B-trees
Image of page 5

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

View Full Document Right Arrow Icon
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
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern