1

In Linux, I have a Java program running. I using jstack [pid] to thread dump my Java app. And detect my processID.

Now I using taskset to assign this process for specific CPU core, but beside that, I can assign to another process into that core also, but I don't want it.

How can I lock that core after I assign my process. Thanks for all!

  • 2
    See https://unix.stackexchange.com/questions/326579/how-to-ensure-exclusive-cpu-availability-for-a-running-process – Kayaman Aug 22 '18 at 08:30
  • Thank Kayaman ! But in your link, I difficult to get an answer! In this post: https://stackoverflow.com/questions/5479458/is-there-a-way-to-lock-a-process-to-a-cpu I found here said no lock. But I'm not sure this process can change CPUcore auto by themself or not. And if no lock, it's mean can assign another thread into this core (1 core can bear with many thread, I think so). – Vo Tan Phuc Aug 23 '18 at 09:04
  • Your link is about thread affinity, my link is about **exclusive** access to a core by thread. Do you have a real reason why you want a core exclusively for your program? – Kayaman Aug 23 '18 at 09:07
  • Hmm.., About core exclusively for my thread. I want it running in specific core, no round robin, don't let another thread run in same core. May be in future, my thread increase more resource. So keep it in specific core to easy to maintain and high performance – Vo Tan Phuc Aug 23 '18 at 09:52
  • Let the OS handle thread scheduling, it's a lot better at it than you are, and you don't seem to have a real need for exclusivity. "Easy to maintain and high performance" are not something you need an exclusive core for. – Kayaman Aug 23 '18 at 09:56

0 Answers0