if want share object using multiprocessing, of following should use depending on circumstances?
- multiprocessing.value or
multiprocessing.array
- or multiprocessing.manager
it seems me that:
value
works object ofctypes
(but what'sctypes
?numpy.ndarray
ctypes
ornetworkx.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
Post a Comment