Shared memory multiprocessor computers contain multiple CPUs. Each CPU can access all of the memory in the machine. In some shared memory multiprocessors, the memory architecture enables each CPU to access some areas of memory more quickly than other areas.
When a machine with such a memory architecture runs Solaris, giving the kernel information about the shortest access times between a given CPU and a given area of memory can improve the system's performance. The locality group (lgroup) abstraction has been introduced in Solaris to handle this information. The lgroup abstraction is part of the Memory Placement Optimization (MPO) feature.
An lgroup is a set of CPU–like and memory–like devices in which each member of the set can access another member of that set within a bounded latency interval. The latency value of each lgroup is chosen by the operating system.
Lgroups are hierarchical. The lgroup hierarchy is a Directed Acyclic Graph (DAG) and is similar to a tree, except that an lgroup may have more than one parent. Like a tree, there is a root. The root lgroup contains all the resources in the system and can include child lgroups. Furthermore, the root lgroup can be characterized as having the highest latency value of all the lgroups in the system. All of its child lgroups will have lower latency values. The lgroups closer to the root have a higher latency while lgroups closer to leaves have lower latency.
A computer in which all the CPUs can access all the memory in the same amount of time can be represented with a single lgroup (see Figure 4–1). A computer in which some of the CPUs can access some areas of memory in a shorter time than other areas can be represented using multiple lgroups (see Figure 4–2).
The organization of the lgroup hierarchy simplifies the task of finding the nearest resources in the system. Each thread is assigned a home lgroup upon creation. The operating system attempts to allocate resources for the thread from the thread's home lgroup by default. For example, the Solaris kernel attempts to schedule a thread to run on the CPUs in the thread's home lgroup and allocate the thread's memory in a way that optimizes for locality. If the desired resources are not available from the thread's home lgroup, the kernel can traverse the lgroup hierarchy to find the next nearest resources from parents of the home lgroup.
The lgroup APIs export the lgroup abstraction for applications to use for observability and operformance tuning. Applications can use the APIs to traverse the lgroup hierarchy, discover the contents and characteristics of a given lgroup, and affect the thread and memory placement on lgroups. A new library, called liblgrp, contains the new APIs.