views:

61

answers:

1

Hi, I want to create a custom malloc which allocates memory blocks within a given address range.

I am writing a pthreads application in which threads are bound to unique cores on a many-core machine. The memory controllers are statically mapped, so that certain range of addresses on main memory are electrically closer to a core. I want to minimize the latency of communication between cores and main memory by allocating thread memory on these "closer" regions.

Any ideas would be most appreciated. Thank you! Nandu

+1  A: 

There is already libnuma for that purpose. Take a look at numa_alloc_onnode

Axel Gneiting