Computer memory Created 2026-10-13 Updated 2026-11-05
Computer memory stores information that a computer can retrieve while executing computer programs. A memory location holds a value, and a memory address selects a location under the machine's addressing rules. In a byte-addressed example, consecutive bytes have consecutive memory addresses; a four-byte value can occupy four locations. The interpretation of those stored bits as a number, an instruction or another representation belongs to the computer program and architecture.
Computer memory has different physical and logical roles. Non-volatile memory retains stored information without power, while other technologies require power to retain it. A memory cache holds selected information for faster reuse; virtual memory presents an operating-system process with its own address space. These describe different properties, so a cached value and its virtual address should not be confused with the physical storage holding it.
In the paging examples, resident memory pages occupy main computer memory, and address translation maps a virtual address to a physical address. The operating system can change a mapping while keeping an operating-system process's numerical virtual address unchanged. This separation makes controlled sharing and isolation possible.[ref]
Operating Systems: Three Easy Pieces by Remzi H. Arpaci-Dusseau and others. chapter 2, memory virtualization overview
Memory location 2026-10-31
An individually addressable place in computer memory holding a value. An abstract memory interface can separate reading and updating existing memory locations from allocating a fresh memory location.
Reading preserves the computer memory; writing returns the unit type value; allocating returns both the fresh memory location and the allocator's updated computer memory:
get :: Monad m => Location -> MemT m Value
get a s = resultM (contents s a,s)
put :: Monad m => Location -> Value -> MemT m ()
put a v s = resultM ((),update s a v)
new :: Monad m => MemT m Location
new s = resultM (fresh s)These use the memory interface in [ref]
Principles of Programming Languages examination paper by the University of Oxford (2015). Printed p. 3, Figure 1
. In particular, fresh already returns its outputs in the order required by the state monad transformer:Expand the two type synonyms to see what survives an exception:In the first order, a failed computation can still produce
(Nothing,s'). The exception handler therefore runs with , including writes made before failure. In the second order, failure produces Nothing, with no returned computer memory. A handler defined by applying the underlying orelse pointwise runs its alternative from the original input computer memory . This gives rollback of this explicit program state for the failed branch.For example, start with a memory location holding , write , fail, and handle the failure by reading that memory location. The first order returns ; the second returns . This rollback concerns the explicit computer memory only: arbitrary effects in the base computational monad are not thereby reversed.A conventional programming language normally retains writes made before an exception is caught. Its mutable computer memory and exception handling therefore correspond more closely to .