Locality of Reference - Reasons For Locality

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:

    I should like to know what is the proper function of women, if it is not to make reasons for husbands to stay at home, and still stronger reasons for bachelors to go out.
    George Eliot [Mary Ann (or Marian)

    Whenever we approve, we can find a hundred good reasons to justify our approbation. Whenever we dislike, we can find a thousand to justify our dislike.
    Samuel Richardson (1689–1761)

    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 (1817–1862)