Skip to content

Instantly share code, notes, and snippets.

@NickCody
Created January 8, 2020 03:27
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 NickCody/50934de21e5cd998959550de5f0c08fb to your computer and use it in GitHub Desktop.
Save NickCody/50934de21e5cd998959550de5f0c08fb to your computer and use it in GitHub Desktop.
Simple Java program to saturate CPU's
package com.primordia.monba.test;
public class Busy {
public static void main(String[] args) {
for (int i = 0; i < 40; i++) {
Runnable runnable = () -> {
Thread t = Thread.currentThread();
long l =0;
while(true) {
l++;
}
};
Thread t = new Thread(runnable);
t.start();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment