The notion of external memory includes a large number of possible
different devices, each of which has their own block size and is
accessed with their own collection of system calls. To simplify the
exposition of this chapter so that we can focus on the common ideas, we
encapsulate external memory devices with an object called a BlockStore.
A BlockStore stores a collection of memory blocks, each of size .
Each block is uniquely identified by its integer index. A BlockStore
supports these operations:
The easiest way to imagine a BlockStore is to think of it as storing a
file on disk that is partitioned into blocks, each containing bytes.
Then
and
simply read and write bytes
of this file. In addition, a simple BlockStore
could keep a free list of blocks that are available for use. Blocks
freed with
are added to the free list. In this way,
can use a block from the free list or, if none is
available, can append a new block to the end of the file.
opendatastructures.org