Posted By

deepsoul on 09/17/09


Tagged

CPU scheduling affinity multi-core


Versions (?)

Get / set CPU affinity (Linux)


 / Published in: Bash
 

Start jobs bound to certain CPU(s), or find the number of available CPUs.

  1. # Bit mask of all CPUs: (affinity mask of init process)
  2. taskset -p 1
  3.  
  4. # CPUs allowed for this shell:
  5. taskset -p $$
  6.  
  7. # Start job with given CPU mask:
  8. taskset mask command
  9.  
  10. # Get / Set CPU mask of running command:
  11. taskset -p `pidof command`
  12.  
  13. taskset -p newmask `pidof command`

Report this snippet  

You need to login to post a comment.