Reasons For Locality
There are several reasons for locality. These reasons are either goals to achieve or circumstances to accept, depending on the aspect. The reasons below are not disjoint; in fact, the list below goes from the most general case to special cases.
- Predictability: In fact, locality is merely one type of predictable behavior in computer systems. Luckily, many of the practical problems are decidable and hence the corresponding program can behave predictably, if it is well written.
- Structure of the program: Locality occurs often because of the way in which computer programs are created, for handling decidable problems. Generally, related data is stored in nearby locations in storage. One common pattern in computing involves the processing of several items, one at a time. This means that if a lot of processing is done, the single item will be accessed more than once, thus leading to temporal locality of reference. Furthermore, moving to the next item implies that the next item will be read, hence spatial locality of reference, since memory locations are typically read in batches.
- Linear data structures: Locality often occurs because code contains loops that tend to reference arrays or other data structures by indices. Sequential locality, a special case of spatial locality, occurs when relevant data elements are arranged and accessed linearly. For example, the simple traversal of elements in a one-dimensional array, from the base address to the highest element would exploit the sequential locality of the array in memory. The more general equidistant locality occurs when the linear traversal is over a longer area of adjacent data structures having identical structure and size, and in addition to this, not the whole structures are in access, but only the mutually corresponding same elements of the structures. This is the case when a matrix is represented as a sequential matrix of rows and the requirement is to access a single column of the matrix.
Read more about this topic: Locality Of Reference
Famous quotes containing the words reasons for, reasons and/or locality:
“The lore of our fathers is a fabric of sentences.... It is a pale gray lore, black with fact and white with convention. But I have found no substantial reasons for concluding that there are any quite black threads in it, or any white ones.”
—Willard Van Orman Quine (b. 1908)
“... But if you shrink from being scared,
What would you say to war if it should come?
Thats what for reasons I should like to know
If you can comfort me by any answer.
Oh, but wars not for children its for men.”
—Robert Frost (18741963)
“The most interesting thing which I heard of, in this township of Hull, was an unfailing spring, whose locality was pointed out to me on the side of a distant hill, as I was panting along the shore, though I did not visit it. Perhaps, if I should go through Rome, it would be some spring on the Capitoline Hill I should remember the longest.”
—Henry David Thoreau (18171862)