A digital computer (see also analog computer) typically consists of a control unit, an arithmetic-logic unit, a memory unit, and input/output units, as illustrated in the figure. The arithmetic-logic unit (ALU) performs simple addition, subtraction, multiplication, division, and logic operations—such as OR and AND. The main computer memory, usually high-speed random-access memory (RAM), stores instructions and data. The control unit fetches data and instructions from memory and effects the operations of the ALU. The control unit and ALU usually are referred to as a processor, or central processing unit (CPU). The operational speed of the CPU primarily determines the speed of the computer as a whole. The basic operation of the CPU is analogous to a computation carried out by a person using an arithmetic calculator, as illustrated in the figure. The control unit corresponds to the human brain and the memory to a notebook that stores the program, initial data, and intermediate and final computational results. In the case of an electronic computer, the CPU and fast memories are realized with transistor circuits.
I/O units, or devices, are commonly referred to as computer peripherals and consist of input units (such as keyboards and optical scanners) for feeding instructions and data into the computer and output units (such as printers and monitors) for displaying results.
In addition to RAM, a computer usually contains some slower, but larger and permanent, secondary memory storage. Almost all computers contain a magnetic storage device known as a hard disk, as well as a disk drive to read from or write to removable magnetic media known as floppy disks. Various optical and magnetic-optical hybrid removable storage media are also quite common, such as CD-ROMs (compact disc read-only memory) and DVD-ROMs (digital video [or versatile] disc read-only memory).
Computers also often contain a cache—a small, extremely fast (compared to RAM) memory unit that can be used to store information that will be urgently or frequently needed. Current research includes cache design and algorithms that can predict what data is likely to be needed next and preload it into the cache for improved performance.