Many thanks for your responses. That does the trick; my computation is much faster now!
However, I want to understand why. My reason for using multiple processes rather than multiple threads is because I wanted to have “real parallelism” i.e. the jobs should run on different cores (in my case, it’s a single machine with 10-40 cores) at the same time. My understanding of threads was that the computer never runs multiple threads at the same time, but rather starts them, one after the other, and the by context switching executes some lines of one thread, then some lines of another thread. I.e. if there was a line of code waiting for an outside action to be triggered (e.g. waiting for a network package), it makes sense to put that waiting part into a separate thread, since that allows other parts of the program to be run while waiting.
Here, however, there does not seem to be a line waiting for an external event to happen. Hence I wanted to use processes rather than threads.
Is my understanding wrong? An answer here says
Well, both multithreading as well as multiprocessing give you parallelism.
So do both give parallelism in the sense of “true parallelism” as described above?