Get / set CPU affinity (Linux)

/ Published in: Bash
Save to your folder(s)

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

Copy this code and paste it in your HTML
  1. # Bit mask of all CPUs: (affinity mask of init process)
  2. taskset -p 1
  4. # CPUs allowed for this shell:
  5. taskset -p $$
  7. # Start job with given CPU mask:
  8. taskset mask command
  10. # Get / Set CPU mask of running command:
  11. taskset -p `pidof command`
  13. taskset -p newmask `pidof command`

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.