When I create a thread with Java or Python I can't find the pid
among the operating system threads. In fact get_ident()
in Python gives me a very large number that can't be the PID.
In fact I need to set the process affinity of all other threads to the first processor core then I want to dedicate the other cores to my specific threads run in a program to create a real time environment. The threads will be less than remaining processor cores.
As I have read in stackoverflow it is not possible in Java and there will be the esigence of native calls. Can it be done in Python or I must use C/C++?
The program will be installed in a Linux machine.
对于Java线程,尤其是在Linux下,存在https://github.com/OpenHFT/Java-Thread-Affinity
I'm not sure I understand what you want exactly, but in Java I remember that I could launch multiple JVM and run my java programs on different OS processes, using inter-processes communication (socket, pipe or whatever you want) to do multi-core processing and syncronization. Knowing that, it might be possible to then set a process (whole JVM) exclusively on a core. You can get the PID of the JVM.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.