shared-memory

Ruby open shared memory block

佐手、 提交于 2019-12-12 04:14:39
问题 Is there a way to open shared memory block with Ruby, equivalent to shmop_open in PHP? I have one process periodically update a memory block. My Rails app needs to read those data. 回答1: You have a few options as gems, but I've never used them myself. sysvmq implements System V IPC message queues. posix-mqueues implements POSIX message queues. 回答2: Maybe try hammerspace We use this as a caching layer for translations and configurations on our production machines. You can have one process that

Shard Memory Ipc triggers the EventHandler on Console, fails on Wpf Application

∥☆過路亽.° 提交于 2019-12-12 04:02:59
问题 I am practicing on implementing a MMF as IPC, I have tried it via wpf as listener and set it's event handler which does trigger. Now that I have moved the same setter code into a Wpf (the setter till that point was Console App) on the Wpf App I could not get the event handler to fire. this is the code I have successfully implemented and I am not sure if this implementation is right, ...the only thing I ma sure of is that it sends data, receives a reply(from wpf actually) and fires its event(

Matlab GPU arrayfun shared variable

 ̄綄美尐妖づ 提交于 2019-12-12 03:30:43
问题 I am using matlab GPU computing with function arrayfun and a gpuArray object to do element-wise function on elements of the gpuArray variable on my function: [ output ] = MyFunc( element, SharedMatrix ) // // Process element with Shared Matrix // end and my code is like so: SharedMatrix = magic(5000); %Large Memory Object SharedMatrix = gpuArray(SharedMatrix); elements = magic(5); gpuElements = gpuArray(elements ); //Error on next line, SharedMatrix object must be a scaler. result = arrayfun(

Can not increase Size of Shared Memory

拟墨画扇 提交于 2019-12-12 02:23:42
问题 Could you please help me? I can not increase the size of my Sherd Memory. The code is written in C on Linux. I need 65536 bytes, but just 49152 seem to be allowed... If I increase it, shmget fails...(in my code: shmid < 0 ) I tried to find out my maximum shared memory size and increased it with: sysctl -w kernel.shmmax=2147483648 But that doesn't help, the initialization again fails. This is my code: #define SHM_KEY 9877 #define SHM_SIZE 65536 int SHM_init (int shmid, char** shm, key_t key,

Multiprocessing using shared memory

a 夏天 提交于 2019-12-12 02:14:33
问题 Can someone provide me with sample code to share a writable array or a list among a pool of worker processes or even individually spawned processes using the multiprocessing module of python using locks? My code below spawns 2 processes of which one should print '1' and the other should print '2' to the shared array. However, when I try to print out the elements of the array after the processing it only gives me a list of 0's. Where am I going wrong? I want a writable data structure to be

Support for non persisted memorymappedfile

我的未来我决定 提交于 2019-12-12 02:07:59
问题 I want to implement memory mapped file concept as a shared memory to share data between two processes running in my windows system. One in Java and another in native (C# layer). Both are running processes and hence i want to use non persisted mechanism for memory mapped files instead of persisted file option (because a file poses a security threat ). Java File Channels http://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html#map(java.nio.channels.FileChannel.MapMode, long,

Implementing pipe using shared memory

三世轮回 提交于 2019-12-12 01:43:33
问题 I'm implementing a pipe using shared memory. I should write and touch only the library, and not the main() . I encountered a problem: Lets say this is the main() of some user who uses my library shared_memory_pipe.h : #include "shared_memory_pipe.h" int main() { int fd[2]; shared_memory_pipe(fd); if (fork()) { while(1) {} } shared_memory_close(fd[0]); shared_memory_close(fd[1]); } In this example we see that child closes both of his fd's, but the father is stuck on an infinite loop, and never

boost interprocess, 2nd process can't open the shared memory created by 1st process

蓝咒 提交于 2019-12-12 00:19:19
问题 I'm writing a Windows application, which needs to share some date between multiple instances (processes). I choose to use boost interprocess. After some investigation, I find managed_windows_shared_memory is best for my situation. But 2nd process can't open shared memory created by 1st process. Code for 1st instance: #include <boost/interprocess/managed_windows_shared_memory.hpp> using namespace boost::interprocess; typedef boost::interprocess::managed_windows_shared_memory SharedMemory;

Is there an easy way to copy a variable in the heap into shared memory

时光怂恿深爱的人放手 提交于 2019-12-11 20:57:15
问题 I have a couple of structs with pointers to one another allocated on the heap. I'm converting a multi-threaded program to a multi-process program so I have to make those structs on the heap into shared memory. So far, I've run into nothing but problems on top of problems. MY TA suggested I use memcpy, but I'm not sure that's going to work. Is there any way to convert a set of structs on the heap into shared memory? Structs I'm using: struct SharedData { int da; int isopen; int refcount; //

Multiprocessing in Python with read-only shared memory?

安稳与你 提交于 2019-12-11 20:29:37
问题 I have a single-threaded Python program, and I'd like to modify it to make use of all 32 processors on the server it runs on. As I envision it, each worker process would receive its job from a queue and submit its output to a queue. To complete its work, however, each worker process would need read-only access to a complex in-memory data structure--many gigabytes of dicts and objects that link to each other. In python, is there a simple way to share this data structure, without making a copy