






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Peter J. Denning, Naval Postgraduate School, Monterey, California January 2008 Rev 6/22/ Abstract: Locality is a universal behavior of all computational processes: They tend to refer repeatedly to subset of their resources over extended time intervals. System designers have exploited this behavior to optimize performance in numerous ways, which include caching, clustering of related objects, search engines, organizations of databases, spam filters, and forensics. Keywords: locality, virtual memory, caching, thrashing, working sets, execution phases, phase transitions, program behavior Locality is a universal behavior of all computational processes: They tend to refer repeatedly to subsets of their resources over extended time intervals. System designers have exploited this behavior to optimize performance in numerous ways, which include caching, clustering of related objects, search engines, organization of databases, spam filters, and forensics. Every executing computation generates references to objects, such as memory pages, disk sectors, database records, and web pages. These references are not uniform: Some objects are referenced more often than others, and references to each object come in bursts. Another way to say this is that execution of a computation consists of a series of phases; phase i has holding time Ti and locality set Li. The locality set is the set of objects referenced in the phase. A particular object is referenced only in the phases in which it is a member of the locality set. Thus, the history of the computation appears as a sequence, ( L1,T2 ), ( L2,T2 ), ( L3,T3 ), ... , ( Li,Ti ), ... The locality set of a multithreaded computation at a particular time is the union of the individual thread locality sets at that time. Knowledge of a computation’s locality behavior has several significant benefits:
The major computer makers were drawn to multiprogrammed virtual memory because of its superior programming environment. RCA, General Electric, Burroughs, and Univac all included virtual memory in their operating systems of the mid-1960s. Because a bad replacement algorithm could cost a million dollars of lost machine time over the life of a system, they all had a keen interest in finding good replacement algorithms. Imagine their chagrin when by 1966 these companies reported a new, unexplained, catastrophic problem they called thrashing. It was a sudden collapse of throughput as the multiprogramming level rose. It had nothing to do with the choice of replacement policy. A thrashing system spent most of its time resolving page faults and little running the CPU. Thrashing was far more damaging than a poor replacement algorithm. It scared the daylights out of the computer makers. IBM avoided these uncertainties by excluding virtual memory from its OS360 in 1964. Instead, it sponsored at its Watson laboratory one of the most comprehensive experimental systems projects of all time. Led by Bob Nelson, Les Belady, and David Sayre, the project team built the first virtual-machine operating system and used it to study the performance of virtual memory. (The term “virtual memory” seems to have come from this project.) By 1 966 they had tested every replacement policy that anyone had ever proposed and a few more they invented. Many of their tests involved the use bits built into page tables. By periodically scanning and resetting the bits, the replacement algorithm distinguishes recently referenced pages from others. Belady concluded that policies that favor recently used pages performed better than other policies; least recently used (LRU) replacement was consistently the best performer among those tested ( 6 ). He said that this resulted from reference clustering locality behavior. His colleagues verified that many programs exhibited locality behavior ( 8 ). At MIT Project MAC in 1966, Peter Denning hypothesized that the controversies over replacement algorithms could be settled by defining an intrinsic memory demand: “This process needs p pages at time t .” Intrinsic demand was the first notion of “working set”. Individual replacement algorithms could then be rated by their abilities to detect working sets. Inspired by Belady’s concept of locality, Denning formally defined a process’s working set as the set of pages used during a fixed-length sampling window in the immediate past ( 2 ). A working set could be measured by periodically reading and resetting the use bits in a page table. This method solved thrashing because if every process is guaranteed its working set, then no process can overload the paging disk and system throughput can be maintained ( 5 ). Thrashing is impossible for a working-set policy. Experiments with real operating systems confirmed that this policy gives high efficiency and prevents thrashing ( 9 ). The working-set idea worked because the pages observed in the backward window were highly likely to be used again in the immediate future. Was this assumption justified? The idea that reference behavior could be described as a sequence of phases and locality sets seemed natural because programmers planned overlays using diagrams that showed subsets and time phases (Fig. 1). But what was strikingly interesting was that programs showed this behavior even when it was not explicitly preplanned. Each program had its own distinctive usage pattern, like a voiceprint (Fig. 2).
Figure 1. Locality sequence behavior diagrammed by programmer during overlay planning. Figure 2. Locality sequence behavior observed by sampling use bits during program execution. Programs exhibit phases and localities naturally, even when overlays are not preplanned. Two effects could make this happen: (1) temporal clustering caused by looping and executing within modules with private data, and (2) spatial clustering caused by related values being grouped into arrays, sequences, modules, and other data structures. Both these reasons followed from the human practice of “divide and conquer” -- breaking a large problem into parts and working separately on each part. The locality bit maps captured someone’s problem-solving method in action. The working set measures an approximation of a program’s intrinsic locality sequence. A distance function gives a single measure of temporal and spatial locality. D(x,t) measures the distance from the execution point of a process to an object x at time t. Distances can be temporal, such as the time since prior reference or access time within a network; spatial, measuring hops in a network or address separation in a sequence; or cost, which measures any nondecreasing accumulation of cost since prior reference. Object x is in the locality set at time t if the distance is withins a threshold: D(x,t) ≤ T.
Figure 3. The modern view of locality is a means of inferring the context of an observer using software, so that the software can dynamically adapt its actions to produce optimal behavior for the observer. A neighborhood is a group of objects related to the observer by some metric. Newer examples of neighborhoods include email correspondents, non-spam email, colleagues, teammates, objects used in a project, favorite objects, user’s web, items of production, texts, and directories. Some neighborhoods can be known by explicit declarations; for example a user’s file directory, address book, or web pages. But most neighborhoods can only be inferred by monitoring the event sequences of an observer’s actions and interactions. Inference can be any reasonable method that measures the content of neighborhoods. Newer inference methods include Google’s counting of incoming hyperlinks to a web page, patterns generated by connectionist networks after being presented with many examples, and Bayesian spam filters. Optimal actions are performed by the software on behalf of the observer. These actions can come either from inside the software with which the observer is interacting, or from outside that software, in the run-time system. The matrix below shows four quadrants that correspond to the four combinations of inference data collection and locus of action just mentioned. Examples of software are named in each quadrant and are summarized below. “Inside” and “outside” are relative to the context-aware software.
Here are seven modern areas that offer challenging research problems that locality may be instrumental in solving. Architecture Computer architects have heavily exploited the locality principle to boost the performance of chips and systems. Putting cache memory near the CPU, either on board the same chip or on a neighboring chip, has enabled modern CPUs to pass the 1 GHz speed mark. Locality within threaded instruction sequences is being exploited by a new generation of multicore processor chips. The “system on a chip” concept places neighboring functions on the same chip to decrease delays of communicating between components significantly. Animated sequences of pictures can be compressed by locality: by detecting the common neighborhood behind a sequence, transmitting it once, and then transmitting the differences for each picture. Architects will continue to examine locality carefully to find new ways to speed up chips, communications, and systems. Caching The locality principle is useful wherever there is an advantage in reducing the apparent distance from a process to the objects it can access. Objects in the neighborhood of the process are kept in a local cache with fast access time. The performance acceleration of a cache generally justifies the modest investment in the cache storage. Novel forms of caching have sprung up in the Internet. One prominent example is edge servers that store copies of Web objects near their users. Another example is the clustered databases built by search engines (like Google) to retrieve relevant objects instantly from the same neighborhoods as the asker. Similar capabilities are available in MacOS Windows to speed up finding relevant objects. Bayesian Inference A growing number of inference systems exploit Bayes’s principle of conditional probability to compute the most likely internal (hidden) states of a system given observable data about the system. Spam filters, for example, use it to infer the email user’s mental rules for classifying certain objects as spam. Connectionist networks use it for learning: Their internal states abstract from desired input-output pairs shown to the network; the network gradually acquires a capability for new action. Bayesian inference is an exploitation of locality because it infers a neighborhood given observations of what a user or process is doing. Forensics The burgeoning field of computer forensics owes much of its success to the ubiquity of caches. They are literally everywhere in an operating systems and applications. By recovering evidence from these caches, forensics experts can reconstruct (infer) an amazing amount of a criminal’s motives and intent ( 11 ). Criminals who erase data files are still not safe, because experts use advanced signal-processing methods to recover the faint magnetic traces of the most recent files from the disk ( 12 ). Learning to draw valid inferences from data in
a computer’s caches, and from correlated data in caches in other computers with which the subject has communicated, is a challenging research problem. Web-Based Business Processes Web-based business systems allow buyers and sellers to engage in transactions using web interfaces to sophisticated database systems. Amazon.com illustrates how a system can infer “book interest neighborhoods” of customers and (successfully) recommend additional sales. Many businesses employ customer relationship management systems that infer “customer interest neighborhoods” and allow the company to provide better, more personalized service. Database, network, server, memory, and other caches optimize the performance of these systems ( 13 ). Context Aware Software More software designers are coming to believe that most software failures can be traced to the inability of software to be aware of and act on the context in which it operates. More and more modern software uses inferred context to be consistently more reliable, dependable, usable, safe, and secure. Network Science Many scientists have begun to apply statistical mechanics to large random networks, typically finding that the distribution of node connections is power law with degree - 2 to - 3 (14,15). These networks are self-similar, which means that if all neighborhoods (nodes within a maximum distance of each other) are collapsed to single nodes, then the resulting network has the same power distribution as the original ( 16 ). The idea that localities are natural in complex systems is not new; in 1976, Madison and Batson (17) reported that program localities have self-similar sub-localities; and in 1977, P. J. Courtois (18) applied it to cluster similar states of complex systems to simplify their performance analyses. The locality principle may offer new understandings of the structure of complex networks. Researchers looking for challenging problems can find many in these areas and can exploit the principle of locality to solve them. BIBLIOGRAPHY