Created
January 8, 2020 03:27
-
-
Save NickCody/50934de21e5cd998959550de5f0c08fb to your computer and use it in GitHub Desktop.
Simple Java program to saturate CPU's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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