Multiprocessing

https://jellis18.github.io/post/2023-01-15-advanced-python-types/

https://jellis18.github.io/post/2023-03-04-concurrency-in-languages/

https://jellis18.github.io/post/2022-01-11-abc-vs-protocol/

Depending on the platform, multiprocessing supports three ways to start a process.

good discussion:

https://stackoverflow.com/questions/64095876/multiprocessing-fork-vs-spawn/66113051#66113051

  • spawn (default on windows, mac)

    • spawn-ing new interpreters

    • Allocate new resources to a subprocess as needed without inheriting resources from the main process.

    • Slow, but safe.

  • fork (default on unix)

    • basically copying the existing interpreter and most of its memory

    • Share all the resources of the main process with the subprocess and start the process.

    • Fast, but dangerous.

  • forkserver

Last updated