The quickest access to storable memory on a computer processing unit (CPU) is a processor register. Computer architectures design processor register memory capability into a CPU cache so that values accessed by computer processes on a regular basis can be stored there. Processes can access and execute speedily based on those stored values. Since the processor registers are stored on the CPU, they are considered to be the top of storage memory hierarchy, and allocation usually is determined by variables. Once data is processed, it is then restored to cache, random access memory (RAM), or hard disk storage.
Computer processors have registers of differing types, according to instructions or tests that operate on them or to their specific content. Data, address, and general purpose registers contain mathematical values and addresses for memory storage. There are conditional registers with truth values for logical operation instructions, constant registers with read-only values such as pi and zero, and special purpose registers that keep a program counter, a status register and stack pointers for stack memory usage. Control registers contain instructions from an instruction set built into the CPU architecture; and there are several that fetch from RAM and circuits of the CPU that access memory buffers, memory data, memory type ranges, and addresses. Variables unassigned to a processor register are stored in RAM and loaded in and out for read and write operations, however, these have slower processing.
Knowing the speed difference between processing in registers and RAM, developers of compiler computer programs usually design their programs to operate as much as possible in the processor register storage for operation of functions quickly. For just-in-time compiler programs, a register allocation technique known as linear scan allocation tracks register operations and frees up register computation power back to the program quickly. Register allocation techniques attempt to get as many of the program’s variables assigned to registers and in an operation flow that maximizes the smallest number of registers for speedy compiling.
As many processor registers are for temporary storage of variables and instruction sets, all the operations for program use can be stored for manipulation by the CPU. In operation, a CPU will first look to the CPU cache of registers for a copy of any data to be processed in read, write, or move operations, before looking to RAM and secondary storage on hard disks. As of 2011, most CPUs keep three individual caches. Instruction caches are concerned with execution fetches by instruction, a translation lookalike buffer speeds up address translations for virtual-to-physical addresses, and a data cache holds a multilevel hierarchy storage of data to be manipulated by a processor register instruction set.