Sharing Python object in multiprocessing: Value or Manager -


if want share object using multiprocessing, of following should use depending on circumstances?

it seems me that:

  • value works object of ctypes (but what's ctypes? numpy.ndarray ctypes or networkx.graph)
  • manager can used arbitrary python object, need wrap object methods

please correct understanding. thanks!

value scalar can hold 1 single data time. therefore, if want share char, double, int, or float between different processes should use array. unlike value, array can hold multiple values.

for extensive list of ctypes defined in python's ctypes: have @ documentation: fundamental data types. therefore, int, bool, long, short , many others datatypes in c programming language.

for manager object, think documentation extensive on that:

managers provide way create data can shared between different processes, including sharing on network between processes running on different machines. manager object controls server process manages shared objects. other processes can access shared objects using proxies.

you might wondering about! have play code see how fits together, not complicated.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -