you can just use the multithreading lib in python
import multiprocessing def get_cpu_threads(): threads = multiprocessing.cpu_count() print(f"CPU can handle {threads} threads") if __name__ == "__main__": get_cpu_threads()