Winner HourStudio HourSign in

Why a computer full of memory can still forget where it put a window

A laptop is running a video call, a spreadsheet and an unreasonable number of browser tabs. Returning to the tab you just left is instant. Returning to a different one takes several seconds, during which the machine seems to contemplate its life choices. Then everything works. The document still…

This article was produced with AI assistance.

A laptop is running a video call, a spreadsheet and an unreasonable number of browser tabs. Returning to the tab you just left is instant. Returning to a different one takes several seconds, during which the machine seems to contemplate its life choices. Then everything works. The document still exists, the processor has the same advertised clock speed and nobody changed the installed memory. The mystery lies in where the necessary information was waiting when you asked for it.

Before there was a window to return to

Go back to the power button. Ordinary working memory is volatile. With power removed, the system cannot count on finding the previous contents of its RAM waiting there. So how does a computer execute the instructions that tell it where to find its operating system? The instructions for getting started live in nonvolatile storage on the machine. A processor starting from reset has a defined route to early firmware code.

The classic PC answer is the BIOS, the Basic Input/Output System. Among its jobs were bringing basic hardware into a usable condition and starting the process of loading the operating system. The archive calls the BIOS the first “kind of memory” to activate. More precisely it is firmware, software stored where it can survive a power cycle. Modern PCs generally use firmware implementing UEFI, which provides a newer boot environment. The central puzzle remains the same. At least some instructions have to be available before an ordinary program has anywhere to run.

Read-only memory, or ROM, was a natural home for instructions intended to stay fixed. The quiz calls ROM static and nonvolatile. Here “static” has its everyday sense of relatively unchanging. Static RAM, ordinarily abbreviated SRAM, is a different technology and normally loses its contents without power. Much modern firmware lives in nonvolatile flash that can be rewritten under controlled conditions. The useful distinction is between keeping information without power and being able to change it. One property does not automatically settle the other.

The desk, the elbow and the pencil already in your hand

When an application opens a file from storage, the operating system commonly brings the working data into RAM. The processor can then use it without repeatedly waiting on an SSD or disk. This is why RAM is the archive’s general answer for the first stop in the working memory hierarchy. Real routes vary. Devices can transfer into memory directly, registers hold values already in use and a processor may find a copy of requested data in a cache.

A cache is a small, fast store for data or instructions likely to be needed soon. Programs often revisit a value they just used, or read a nearby value next. Hardware takes advantage of those habits by transferring blocks called cache lines. If the desired information is already there, the processor can frequently avoid a longer trip to main memory. A cache miss means somebody has to fetch the missing line from another level. Repeating a calculation over neatly arranged data can therefore run very differently from jumping among distant addresses.

Suppose a spreadsheet repeatedly adds the values across neighboring cells. The layout in memory may allow several of them to arrive in one fetch. Then imagine each cell tells the computer the address of an unrelated cell to visit next. The second calculation might perform the same number of arithmetic operations, yet spend much longer waiting to learn where to go. The multiplication table printed on a processor’s box has very little to say about that delay.

A clock, a road and the wait at the first traffic light

A clock cycle is one beat of a repeating timing signal. The number of beats per second is a frequency, measured in hertz. A three-gigahertz clock has three billion cycles per second. The quiz links cycles to CPU processing speed, a useful association as long as one keeps the units straight. A single cycle is a period of time. Different instructions use resources differently, and modern processors can overlap work on several instructions. Two chips sharing a clock frequency can complete a task in different amounts of time.

Memory has a timing vocabulary of its own. Bus width describes how many bits can be transferred across a data path in one transfer. A sixty-four-bit-wide path can carry eight bytes at once. Transfers per second and the number of channels also affect bandwidth, the amount moved in a given time. Latency asks how long one request takes before the needed data becomes available. It can be expressed in time or, for specified operations, in clock cycles. Comparing cycle counts without knowing the clock period can be misleading.

A long freight train makes the distinction intuitive. It can take a while for the first carriage to reach the crossing and still move a great deal of cargo past you in the following minute. A program streaming through a large file may care deeply about bandwidth. A program waiting for one value before it can ask for the next one is particularly exposed to latency. Buying more cargo capacity cannot make an already distant first carriage arrive instantly.

The tab that had to come back from storage

Each program ordinarily sees a virtual address space. The operating system and hardware map the pages of those addresses to physical memory as needed. The subset of a process’s pages currently resident in physical RAM is its working set. If all the applications demand more active space than the machine has available, the system can reclaim less recently needed pages. A clean file-backed page may be discarded and read again from its file. Modified private data may need to be written to a page file or swap area before its RAM can be reused.

Now return to that old browser tab. If it touches a page that is absent, the operating system has to make the page available again. Storage access can take far longer than access to RAM. Under pressure, repeatedly evicting and retrieving pages can leave the machine busy but conspicuously unproductive. Browsers can also discard whole tabs and reload them by their own rules. A slowdown is a clue about possible RAM pressure, not a conclusive diagnosis. Sometimes the computer performed exactly the requested work. It simply had farther to travel to collect the ingredients.

Play the quiz: Computer Memory Essentials Challenge

Sources