multithreading - Java thread affinity -


does know of way lock down individual threads within java process specific cpu cores (on linux)? i've done in c, can't find how in java. instincts require jni call, hoping here might have insight or might have done before.

thanks!

you can't in pure java. if need -- can use jni call native code job. place start with:

http://ovatman.blogspot.com/2010/02/using-java-jni-to-set-thread-affinity.html

http://blog.toadhead.net/index.php/2011/01/22/cputhread-affinity-in-java/

upd: after thinking, i've decided create own class this: threadaffinity.java it's jna-based, , simple -- so, if want use in production, may should spent time making more stable, benchmarking , testing works is.

upd 2: there library working thread affinity in java. uses same method noted, has interface


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -