Skip to content

Instantly share code, notes, and snippets.

@Bwooce
Created April 11, 2013 05:02
Show Gist options
  • Save Bwooce/5360864 to your computer and use it in GitHub Desktop.
Save Bwooce/5360864 to your computer and use it in GitHub Desktop.
Use max cpu on any box
package main
import (
"runtime"
"fmt"
)
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
fmt.Println("Starting to use cpu on", runtime.NumCPU(), "cores")
for i:=0;i<runtime.NumCPU()-1;i++ {
go forever()
}
for { }
}
func forever() {
for { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment