[Openmcl-devel] Thread-local allocation pools

R. Matthew Emerson rme at clozure.com
Tue Nov 9 16:25:50 UTC 2010

On Nov 9, 2010, at 10:42 AM, David L. Rager wrote:

> It appears that cache thrashing could be a cause of bad performance in
> my multi-threaded application.  Is there a way to tell CCL threads to
> use a thread-local allocation pool that can still be read from other
> threads?

You could try playing around with setting processor affinity, at least on Linux.

Given a process p, you can get the pthread via
(ccl::lisp-thread-os-thread (ccl::process-thread p))

You could then use pthread_setaffinity_np(3) on that.

Alternatively, (ccl::lisp-thread-native-thread (ccl::process-thread p)) gives you the lower-level thread id, and you could try using sched_setaffinity(2) on that.

You'll have to figure out how to build a cpu_set_t value from lisp, but that is probably not too bad.

If this turns out to be useful functionality, we should probably come up with some decent lisp interface for it.  (On the other hand, not all systems support processor affinity.  Darwin, for example, doesn't, at least as far as I know.)

More information about the Openmcl-devel mailing list