shared-memory

Create a new obj with deepcopy but new obj share variable with the old obj

淺唱寂寞╮ 提交于 2019-12-11 08:44:42
问题 I am dealing with some classes using pygraph module and when I use add_node() method, it always comes out 'node xxx already in graph'. So I try to use deepcopy() to create a new instance and have some problem with it: class test: _storage = [] def add_item(self,item): self._storage.append(item) def pop_item(self,item): return self._storage.pop() def __repr__(self): return '%s' %self._storage[:] if __name__ == '__main__': a1 = test() a1.add_item(3) a1.add_item(4) from copy import copy,deepcopy

Using CreateFileMapping between two programs - C

六月ゝ 毕业季﹏ 提交于 2019-12-11 08:37:00
问题 I have two window form applications written in C, one holds a struct consisting of two integers, another will receive it using the CreateFileMapping. Although not directly related I want to have three events in place so each of the processes can "speak" to each other, one saying that the first program has something to pass to the second, one saying the first one has closed and another saying the second one has closed. What would be the best way about doing this exactly? I've looked at the

Julia allocates huge amount of memory for unknown reason

邮差的信 提交于 2019-12-11 08:24:57
问题 I'm trying to parallelize a little scientific code I wrote. But when I add @parallelize , similar code on just one processor suddenly takes 10 times as long to execute. It should take roughly the same amount of time. The first code makes one memory allocation, while the second makes 20. But zeros(Float64, num_bins) should not be a bottleneck. num_bins is 1800. So each call to zeros() should be allocating 8*1800 bytes. 20 calls to allocate 14,400 bytes should not be taking this long. I can't

Can boost's interprocess segment manager allocators be themselves shared with other processes?

£可爱£侵袭症+ 提交于 2019-12-11 08:13:23
问题 I am creating a shared interprocess map using boost::interprocess. For this I create an allocator from the segment_manager of the shared memory segment where the map is located. The element value type of the map is a basic_string which is itself templated to use a char allocator created from the same segment manager. In one process I create the map and in the other I search for an item using the maps iterator in that process and in some cases I call map::erase with the iterator. This causes

Shared Memory when it's for read only

ε祈祈猫儿з 提交于 2019-12-11 08:05:34
问题 I am reading beej's guide for Shared Memory Segments At the end he says: More commonly, a process will attach to the segment and run for a bit while other programs are changing and reading the shared segment. It's neat to watch one process update the segment and see the changes appear to other processes. Again, for simplicity, the sample code doesn't do that, but you can see how the data is shared between independent processes. My question is: it is necessary when the shared memory is for

boost::interprocess Containers of containers NOT in shared memory copy

人走茶凉 提交于 2019-12-11 07:53:41
问题 Based on a previous question boost::interprocess Containers of containers NOT in shared memory I am able to create objects in the shared memory and on the heap. What I want now is a template deep copy function to copy between heap an shm usable with all interprocess vectors independent to the allocator. #include <boost/interprocess/containers/vector.hpp> #include <boost/interprocess/allocators/allocator.hpp> #include <boost/interprocess/managed_shared_memory.hpp> #include <boost/range

C memory sharing across 2 programs

人盡茶涼 提交于 2019-12-11 06:53:58
问题 I have 2 programs a writer and a reader. The writer is supposed to create shared memory and then save an array of structs to that piece of memory... reader is supposed to use that piece of memory and be able to output what was saved in the memory by the writer. I'm very much struggling to output more then just the first part of the array so I'm not even sure if the array is saving correctly to the shared memory so i said I'd post my code here and maybe someone could help me out... WRITER:

Using IVSHMEM with libvirt virt-manager

不问归期 提交于 2019-12-11 06:36:31
问题 Using ivshmem in qemu requires the following steps. Start ivshmem server in host ./ivshmem_server which will create a unix domain socket /tmp/ivshmem_socket Start qemu with the following command line options- -chardev socket,path=/tmp/ivshmem_socket,id=ivshmem_socket -device ivshmem,chardev=ivshmem_socket,size=1m Now if we do lspci in guest, the ivshmem pci device is shown in it. How can I do the same in virt-manager? Specifically, I want to do 2 things. Pass the above command line option to

SQLCE 4 - EF4.1 Internal error: Cannot open the shared memory region

女生的网名这么多〃 提交于 2019-12-11 06:19:22
问题 Hi im trying to run my MVC 3 application running SQLCE 4 embedded and EF4.1 i have used the data access methods as described in this tutorial This works perfectly locally(obviously), but when running it on my hosting i get the below error message. It is a shared hosting enviroment. Is it an open connection that is the problem? Shouldn't it be handled by the unit of work class that is returning the dbcontext as a singleton throughout the whole application as mentioned in the tutorial? Any tips

Instantiating class with custom allocator in shared memory

北城余情 提交于 2019-12-11 06:07:14
问题 I'm pulling my hair due to the following problem: I am following the example given in boost.interprocess documentation to instantiate a fixed-size ring buffer buffer class that I wrote in shared memory. The skeleton constructor for my class is: template<typename ItemType, class Allocator > SharedMemoryBuffer<ItemType, Allocator>::SharedMemoryBuffer( unsigned long capacity ){ m_capacity = capacity; // Create the buffer nodes. m_start_ptr = this->allocator->allocate(); // allocate first buffer