Skip to content

Instantly share code, notes, and snippets.

@rsaxvc
Created January 3, 2017 06:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsaxvc/f34e33f9217d7e81b248b529bc6d8452 to your computer and use it in GitHub Desktop.
Save rsaxvc/f34e33f9217d7e81b248b529bc6d8452 to your computer and use it in GitHub Desktop.
Cron Script to assign distinct CPU cores to Boinc jobs.
#!/bin/bash
#This script assumes #BOINC <= #Cores. To fix this, use a modulo function.
CORE=0
pgrep -f "/usr/lib/virtualbox/VBoxHeadless --comment boinc_" | while read -r pid ; do
taskset -a -pc "$CORE" "$pid" #This locks the VM to a specific core.
CORE=$((CORE+1)) #Use this without hyperthreading
#CORE=$((CORE+2)) #Use this with hyperthreading
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment