in computer science, cache coloring (also known as page coloring) is the process of attempting to allocate free pages that are contiguous from the cpu cache's point of view, in order to maximize the total number of pages cached by the processor. cache coloring is typically employed by low-level dynamic memory allocation code in the operating system, when mapping virtual memory to physical memory. a virtual memory subsystem that lacks cache coloring is less deterministic with regards to cache performance, as differences in page allocation from one program run to the next can lead to large differences in program performance. ==details of operations==  a physically indexed cpu cache is designed such that addresses in adjacent physical memory blocks take different positions ("cache lines") in the cache, but this is not the case when it comes to virtual memory; when virtually adjacent but not physically adjacent memory blocks are allocated, they could potentially both take the same position in the cache. coloring is a technique implemented in memory management software, which solves this problem by selecting pages that do not contend with neighbor pages. physical memory pages are "colored" so that pages with different "colors" have different positions in cpu cache memory. when allocating sequential pages in virtual memory for processes, the kernel collects pages with different "colors" and maps them to the virtual memory. in this way, sequential pages in virtual memory do not contend for the same cache line. ==implementations== this code adds a significant amount of complexity to the virtual memory allocation subsystem, but the result is well worth the effort. page coloring makes virtual memory as deterministic as physical memory in regard to cache performance. page coloring is employed in operating systems such as solaris, freebsd, netbsd,  and [
Cache_(computing)