A system and method for object rundown protection that scales with the
number of processors in a shared-memory computer system is disclosed. In
an embodiment of the present invention, prior to object rundown, a
cache-aware reference count data structure is used to prevent
cache-pinging that would otherwise result from data sharing across
processors in a multiprocessor computer system. In this data structure, a
counter of positive references and negative dereferences, aligned on a
particular cache line, is maintained for each processor. When an object
is to be destroyed, a rundown wait process is begun, during which new
references on the object are prohibited, and the total number of
outstanding references is added to an on-stack global counter.
Destruction is delayed until the global reference count is reduced to
zero. In an embodiment of the invention suited to implementation on
non-uniform memory access multiprocessor machines, each processor's
reference count is additionally allocated in a region of main memory that
is physically close to that processor.