A method and apparatus is described herein for supporting heterogeneous
local memories. A resource affinity table includes an entry for each
local memory mapped into an address space. Each entry associating the
corresponding local memory with a logical distance, such as a domain
number. During runtime thread scheduling, memory operations, and other
tasks are potentially assigned to the local memory devices based on the
logical distance associated with each memory in the resource affinity
table. As a consequence, heterogeneous memory types or homogeneous
memories with different access times may be efficiently combined in a
system to achieve large amount of memory at a smaller cost without
sacrificing performance by allowing an operating system to make
intelligent scheduling choices based on logical distances/access times of
the aforementioned memories.