Results 1 to 3 of 3

what is Locality of Reference?

This is a discussion on what is Locality of Reference? within the Operating Systems forums, part of the category; I am looking for a simply definition of Locality of Reference please. Thanks....

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Answers
    4

    what is Locality of Reference?

    I am looking for a simply definition of Locality of Reference please.
    Thanks.


  2. #2
    Contributing Member
    Join Date
    Oct 2008
    Answers
    72

    Re: what is Locality of Reference?

    In computer science, locality of reference, also called the principle of locality, is the term applied to situations where the same value or related storage locations are frequently accessed. There are three basic types of locality of reference: temporal, spatial and sequential:

    Temporal locality
    Here a resource that is referenced at one point in time is referenced again soon afterwards.
    Spatial locality
    Here the likelihood of referencing a storage location is greater if a storage location near it has been recently referenced.
    Sequential locality
    Here storage is accessed sequentially, in descending or ascending order.

    Reasons for occurrence:

    The reason locality occurs is often because of the manner in which computer programs are created. Generally, data that are related are stored in consecutive locations in storage. One common pattern in computing is that processing is performed on a single item and then the next. 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.

    Locality often occurs because code contains loops that tend to reference arrays or other data structures by indices.

    Increasing and exploiting locality of reference are common techniques for optimization. This can happen on several levels of the memory hierarchy. Paging obviously benefits from spatial locality. A cache is a simple example of exploiting temporal locality, because it is a specially designed faster but smaller memory area, generally used to keep recently referenced data and data near recently referenced data, which can lead to potential performance increases. Data in cache does not necessarily correspond to data that is spatially close in main memory; however, data elements are brought into cache one cache line at a time. This means that spatial locality is again important: if one element is referenced, a few neighbouring elements will also be brought into cache. Finally, temporal locality plays a role on the lowest level, since results that are referenced very closely together can be kept in the machine registers. Programming languages such as C allow the programmer to suggest that certain variables are kept in registers.


  3. #3
    Contributing Member
    Join Date
    Oct 2008
    Answers
    72

    Re: what is Locality of Reference?

    In computer science, locality of reference, also called the principle of locality, is the term applied to situations where the same value or related storage locations are frequently accessed. There are three basic types of locality of reference: temporal, spatial and sequential:

    Temporal locality
    Here a resource that is referenced at one point in time is referenced again soon afterwards.
    Spatial locality
    Here the likelihood of referencing a storage location is greater if a storage location near it has been recently referenced.
    Sequential locality
    Here storage is accessed sequentially, in descending or ascending order.

    Reasons for occurrence:

    The reason locality occurs is often because of the manner in which computer programs are created. Generally, data that are related are stored in consecutive locations in storage. One common pattern in computing is that processing is performed on a single item and then the next. 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.

    Locality often occurs because code contains loops that tend to reference arrays or other data structures by indices.

    Increasing and exploiting locality of reference are common techniques for optimization. This can happen on several levels of the memory hierarchy. Paging obviously benefits from spatial locality. A cache is a simple example of exploiting temporal locality, because it is a specially designed faster but smaller memory area, generally used to keep recently referenced data and data near recently referenced data, which can lead to potential performance increases. Data in cache does not necessarily correspond to data that is spatially close in main memory; however, data elements are brought into cache one cache line at a time. This means that spatial locality is again important: if one element is referenced, a few neighbouring elements will also be brought into cache. Finally, temporal locality plays a role on the lowest level, since results that are referenced very closely together can be kept in the machine registers. Programming languages such as C allow the programmer to suggest that certain variables are kept in registers.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact

SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.