Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Python share memory among multiple processes?

I read that processes operate on seperate memory spaces (link). However the multiprocessing package of python offers shared memory (multiprocessing.Value, multiprocessing.Array).

  • Where (in which process) is this data stored?
  • Is the data accessed by reference by the child processes?
like image 995
Oliver Wilken Avatar asked Jun 17 '17 18:06

Oliver Wilken


1 Answers

The data is allocated in a shared, anonymous memory map created through the mmap module. You can see the code here and here.

like image 55
user2357112 supports Monica Avatar answered Oct 04 '22 02:10

user2357112 supports Monica