-
Notifications
You must be signed in to change notification settings - Fork 79
Getting started
peter-lawrey edited this page Dec 12, 2011
·
8 revisions
The Affinity Library lets you assign and release CPUs to threads.
First you need to build the library for your platform on Linux.
- Check it out the source
- make the Makefile executable (on unix) chmod +x src/main/c/Makefile (You need
gcc
andmake
installed) - Compile it with mvn compile
- Add the library libaffinity.so to your LD_LIBRARY_PATH or link it to you work directory.
- Build it with mvn test
Try running vanilla.java.affinity.AffinitySupportMain and it should print something like
Estimated clock frequency was 3400 MHz
Assigning cpu 7 to Thread[main,5,main]
Assigning cpu 6 to Thread[reader,5,main]
Releasing cpu 7 from Thread[main,5,main]
The assignment of CPUs is
0: General use CPU
1: General use CPU
2: Reserved for this application
3: Thread[writer,5,main] alive=true
4: General use CPU
5: General use CPU
6: Thread[reader,5,main] alive=true
7: Thread[engine,5,main] alive=true
Assigning cpu 7 to Thread[engine,5,main]
Releasing cpu 6 from Thread[reader,5,main]
Releasing cpu 3 from Thread[writer,5,main]
Releasing cpu 7 from Thread[engine,5,main]