MentaAffinity is a Java library for setting thread affinity in Linux. That means you can pin a thread to a single logical processor in order to avoid interrupts, context switches and cpu cache misses. It also allows you to distribute your threads through the cpu architecture, so you can run them in different physical processors, in different cores or in the same core if the processor has hyper-threading. Depending on what your threads are doing and on what kind of information they are sharing that can have a big impact on performance.
MentaAffinity parses the /proc/cpuinfo file to understand the machine cpu architecture so it can distribute threads across processing units:
Just keep in mind that for MentaAffinity the Processor object is the logical processor and NOT the physical processor. The physical processor is the Chip object.
The basics of MentaAffinity is to allow you to pin a thread to a logical processor:
Failed to load source code from svn: http://soliveirajr.com/svn/mentaaffinity/trunk/src/main/java/org/mentaaffinity/sample/BasicBindToProcessor.java