The External-Memory Model and Block Transfers
Compare sequential scans and random accesses when the scarce resource is movement of entire blocks.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Specify the size of the memory and the unit of movement
Let fast memory hold \(M\) records and one transfer move \(B\) adjacent records. Scanning a contiguous array of \(N\) records uses \(\Theta(\lceil N/B\rceil)\) transfers. Repeatedly visiting one record from unrelated blocks can require a transfer per access unless the working set or visit ordering provides reuse. Counting CPU instructions alone does not expose this difference.
Merge several runs per pass
An external sort can sort memory-sized runs, then use one input block per run and one output block. With room for about \(M/B\) blocks, it can merge that many runs up to constants. Each pass reads and writes the data sequentially, reducing the run count by the merge fan-in. The number of passes depends on \(N/M\) and \(M/B\). B-tree fan-out uses a related block-size argument for random lookups. Cache-oblivious layouts build locality without placing \(B\) directly in the algorithm.[1][2]