I get a error when I run this code.
from multiprocessing import Process, cpu_count
import time
def counter(num):
count = 0
while count < num:
count += 1
def main():
print("cpu count:", cpu_count())
a = Process(target=counter, args=(500000000,))
b = Process(target=counter, args=(500000000,))
a.start()
b.start()
print("processing...")
a.join()
b.join()
print("Done!")
print("finished in:", time.perf_counter(), "seconds")
main()
I was expecting Python to print up to 1000000000 but it just gives me a unexpected error. I am not sure what if name == "main": does so I have not used it.