You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python doesn't do anything to bind processes or threads to cores; it just leaves things up to the OS. When you spawn a bunch of independent processes (or threads, but that's harder to do in Python), the OS's scheduler will quickly and efficiently get them spread out across your cores without you, or Python, needing to do anything (barring really bad pathological cases).
I'm also assuming you aren't using explicit locks, other synchronization, Manager objects, or anything else that will serialize your code. If you do, obviously you can't get full parallelism.
And I'm also assuming you aren't using (mutable) shared memory, like a multiprocessing.Array that everyone writes to. This can cause cache and page conflicts that can be almost as bad as explicit locks.
The text was updated successfully, but these errors were encountered:
See stackoverflow on [How do CPU cores get allocated to python processes in multiprocessing?](https://stackoverflow.com/a/49993798):
The text was updated successfully, but these errors were encountered: