Skip to content

cpsy/python multiprocessing #12

@dunland

Description

@dunland

See stackoverflow on [How do CPU cores get allocated to python processes in multiprocessing?](https://stackoverflow.com/a/49993798):

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Informationjust some collected info stored here not to forget.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions