Locality of reference, also known as the principle of locality, is the tendency of a processor to access the same set of memory locations repetitively over a short period of time.
The computer program’s tendency to access instructions whose addresses are close together is referred to as locality of reference.
Two type of locality
- Temporal locality
- Spatial locality
1. Temporal locality
The currently fetched instruction may be required again in the near future.
2. Spatial locality
The instructions immediately adjacent to the current instruction may be required soon.