B-Trees

Learn about external memory and how it stores data and B-tree structure.

External memory overview

An implicit assumption of the ww-bit word-RAM model is that our computer has a large enough random access memory to store all of the data in the data structure. In some situations, this assumption is not valid. There exist collections of data so large that no computer has enough memory to store them. In such cases, the application must resort to storing the data on some external storage medium such as a hard disk, a solid-state disk, or even a network file server (which has its own external storage).

Accessing an item from external storage is extremely slow. The hard disk attached to the computer on which this module was written has an average access time of 1919ms and the solid-state drive attached to the computer has an average access time of 0.30.3ms. In contrast, the random access memory in the computer has an average access time of less than 0.0001130.000113ms. Accessing RAM is more than 2,5002,500 times faster than accessing the solid-state drive and more than 160,000160,000 times faster than accessing the hard drive.

These speeds are fairly typical; accessing a random byte from RAM is thousands of times faster than accessing a random byte from a hard disk or solid-state drive. Access time, however, does not tell the whole story. When we access a byte from a hard disk or solid-state disk, an entire block of the disk is read. Each of the drives attached to the computer has a block size of 4,0964,096; each time we read one byte, the drive gives us a block containing 4,0964,096 bytes. If we organize our data structure carefully, this means that each disk access could yield 4,0964,096 bytes that are helpful in completing whatever operation we are doing.

In the external memory model, accessing an individual item, xx, in the external memory requires reading the entire block containing xx into RAM.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy