Skip to content

Instantly share code, notes, and snippets.

@bison--
Created July 21, 2022 01:04
Show Gist options
  • Save bison--/b06e19bf71067733da2462f2a464c873 to your computer and use it in GitHub Desktop.
Save bison--/b06e19bf71067733da2462f2a464c873 to your computer and use it in GitHub Desktop.
a simple and dirty CPU time burner
import subprocess
import time
thread_amount = int(input('amount of threads:'))
all_processes = []
try:
for i in range(thread_amount):
all_processes.append(subprocess.Popen(["md5sum", "/dev/zero"]))
except Exception as ex:
print("Error: unable to start process", ex)
keep_running = True
try:
while keep_running:
time.sleep(1)
except KeyboardInterrupt:
keep_running = False
print('STOPPING')
for process in all_processes:
process.kill()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment