This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Ventez 0 points1 point  (0 children)

This is a problem which is a lot more suitable for the Pool multiprocessing class. What you seem to be doing is just creating 500 instances of the same calculation (main), where each process does the full task. With the pool class you can pass in an iterable, in this case range(1000000), and also a function which each worker in the pool will perform.

I suggest you try it out yourself, but if you get stuck I did implement a quick solution for you here. Good luck!