Skip to content
Part IA Michaelmas Term

Abstractions, Interfaces, and the Narrow Waist

Interfaces as liberation

An interface is a contract that liberates application writers from low-level details. It represents an abstraction of the resources and services used by applications. In an ideal world, implementations can change without requiring changes to applications.

In practice, this ideal is often undermined by:

  • Performance concerns: a naive abstraction may perform poorly on a particular implementation, forcing the application writer to become aware of what lies beneath.
  • Mission creep: the interface specification grows over time, adding features that tie applications to specific implementations.
  • Specification change: the interface itself is revised, breaking existing applications.

Standard interfaces are everywhere

The narrow waist pattern recurs in many engineered systems:

SystemInterfaceWhat sits aboveWhat sits below
National electricity grid230 V, 50 Hz socketAppliancesPower stations, renewables, interconnectors
Landline telephoneRJ11 jack, dial toneTelephones, fax machines, modemsExchanges, trunks, fibre, microwave links
MoneyCurrency units, pricesBuyers, sellers, contractsCentral banks, commercial banks, ledgers
TCP/IPSockets, portsApplicationsEthernet, Wi-Fi, 4G, fibre

In each case, the interface decouples the consumers of a service from the providers. New providers can enter below the interface; new consumers can enter above it.

The DBMS logical arrangement

DBMS Logical Arrangement: layered stack from user applications down through the DBMS, OS file system, drivers, to physical storage

Applications interact only with the DBMS. The DBMS uses the operating system’s file system, which in turn uses device drivers to access physical storage. Some high-performance DBMSs bypass the file system and manage raw storage devices directly.

Storage interface primitives

Primary storage (RAM) provides a simple word-level interface:

write(address, word)
read(address)

Secondary storage (disk/SSD) provides a block-level interface:

write(blkaddress, block)
read(blkaddress) → option(block)
trim(blkaddress)
sync()
  • read returns an option: the block might not exist (unlike RAM, where every address always contains something).
  • trim tells the device that a block is no longer needed (used by SSDs for garbage collection).
  • sync flushes buffered writes to persistent media.

Storage configurations

ConfigurationWhere data livesPersistence
In-corePrimary memory (RAM)Ephemeral — lost on process exit or power loss
Serialised to filesystemFiles managed by the OSPersistent across restarts
Direct device accessRaw secondary storage, bypassing the file systemPersistent, with full DBMS control over layout

Most general-purpose DBMSs use the serialised-to-filesystem configuration. In-core databases (e.g., Redis) are used where latency is critical and the dataset fits in RAM.

Summary

  • An interface is an abstraction that decouples consumers from providers.
  • The narrow waist model appears in many engineered systems, not just databases.
  • The DBMS sits between user applications and the file system/device drivers.
  • Secondary storage differs from primary storage in providing block-level access with optional read results.