shared-memory

Python multiprocess dict of list

天涯浪子 提交于 2021-01-27 19:00:46
问题 I need to do some stuffs in multiprocess with Python 3.6. Namely, I have to update a dict adding lists of objects. Since these objects are unpickable I need to use dill instead of pickle and multiprocess from pathos instead of multiprocessing , but this should not be the problem. Adding a list to the dictionary needs to reserialize the list before of adding to the dictionary. This slow down everything and it takes the same time as without multiprocessing. Could you suggest me a workaround?

PHP and sharing resources between requests

爷,独闯天下 提交于 2021-01-27 06:31:40
问题 I'm looking for a way to share PHP resources between requests. First of all, I want to share parsed XML. I have some large XML that I use in readonly mode, and currently I have to load and parse it for each HTTP request. I've read this: http://php.net/manual/en/function.shm-put-var.php and the other shared memory API documentation, and I know that there is no straight way to store resources in shared memory. That's why I ask here. So, I have XML, I use it in readonly mode (performing XPath

Can I resize Linux shared memory with shmctl?

笑着哭i 提交于 2021-01-21 06:50:07
问题 I have a C++ application that allocates shared memory on a Linux system via shmget(2). The data that I store in the shared memory grows periodically, and I'd like to resize the shared memory in a way analogous to the way realloc() grows regular memory. Is there a way to do this? I found a doc on IBM's site that mentions a SHM_SIZE command, but the Linux and BSD manpages do not have it, even in the Linux-specific sections. 回答1: Simple answer: there is no easy way. The reasons are pretty

Does userfaultfd now support file backed map?

 ̄綄美尐妖づ 提交于 2021-01-01 03:56:36
问题 I saw from the documentation of userfaultfd https://manpages.debian.org/testing/manpages-dev/userfaultfd.2.en.html http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html that userfaultfd will start supporting shared map since kernel 4.11. However, the documentation still looks very ambiguous in the sense that I'm still wondering will these include supporting file-backed mmap (which can also be MAP_SHARED)? 回答1: To answer definitively, since the information is not in the manual page(s),

Does userfaultfd now support file backed map?

瘦欲@ 提交于 2021-01-01 03:56:32
问题 I saw from the documentation of userfaultfd https://manpages.debian.org/testing/manpages-dev/userfaultfd.2.en.html http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html that userfaultfd will start supporting shared map since kernel 4.11. However, the documentation still looks very ambiguous in the sense that I'm still wondering will these include supporting file-backed mmap (which can also be MAP_SHARED)? 回答1: To answer definitively, since the information is not in the manual page(s),

Does userfaultfd now support file backed map?

与世无争的帅哥 提交于 2021-01-01 03:55:53
问题 I saw from the documentation of userfaultfd https://manpages.debian.org/testing/manpages-dev/userfaultfd.2.en.html http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html that userfaultfd will start supporting shared map since kernel 4.11. However, the documentation still looks very ambiguous in the sense that I'm still wondering will these include supporting file-backed mmap (which can also be MAP_SHARED)? 回答1: To answer definitively, since the information is not in the manual page(s),

Does userfaultfd now support file backed map?

…衆ロ難τιáo~ 提交于 2021-01-01 03:51:07
问题 I saw from the documentation of userfaultfd https://manpages.debian.org/testing/manpages-dev/userfaultfd.2.en.html http://man7.org/linux/man-pages/man2/ioctl_userfaultfd.2.html that userfaultfd will start supporting shared map since kernel 4.11. However, the documentation still looks very ambiguous in the sense that I'm still wondering will these include supporting file-backed mmap (which can also be MAP_SHARED)? 回答1: To answer definitively, since the information is not in the manual page(s),

Passing Data between Java and C++ [closed]

三世轮回 提交于 2020-12-26 05:14:43
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 25 days ago . Improve this question I am working on developing an application in which I have an application layer in Java and one service which is nothing but a plugin in C++. I need to call native code APIs from the application layer which will be called through the JNI layer which is

How to construct boost spsc_queue with runtime size parameter to exchange cv::Mat objects between two processes using shared memory?

醉酒当歌 提交于 2020-12-15 05:21:27
问题 Trying to implement a produced consumer scenario where one process feeds cv::Mat objects into a queue buffer. And the consumer consumes them. cv::Mat has a settable allocator that can be implemented for custom memory management, but I had no success in making it work. Popping from the que on consumer side led to segfaults. The closest I've got is this implementation whwre cv::Mat is serialized and deserialized. Another downside of this implementation is buffer size is defined during

Boost shared memory and synchronized queue issue/crash in consumer process

喜夏-厌秋 提交于 2020-12-06 12:35:59
问题 I'm trying to consume from a child process a synchronized queue in c++. I'm using this synchronized queue in C++ () (http://www.internetmosquito.com/2011/04/making-thread-safe-queue-in-c-i.html) I modified the queue to be serializable in boost and also replaced the used boost::mutex io_mutex_ to use instead an inteprocess mutex (thanks @Sehe) boost::interprocess::interprocess_mutex io_mutex_ And when locking I changed every line that has boost::mutex::scoped_lock lock(io_mutex_); to scoped