shared-memory

Sharing data array between two applications in Delphi

不打扰是莪最后的温柔 提交于 2019-11-28 09:16:56
I want to share array data between two applications. In my mind, first program create the array and the second program can read the array from already allocated memory area. The array is not a dynamic array. I found a way to share pointer using OpenFileMapping and MapViewOfFile . I have no luck to implement array sharing and I think i don't want to use IPC method yet. Is it possible to plan a scheme like this (sharing array)? My purpose is to minimize memory usage and reading data quickly. Cosmin Prund Scratched my head thinking of what a short-but-complete example of sharing memory between

How to globally set the default clause to none?

谁说我不能喝 提交于 2019-11-28 08:37:22
问题 I know I can tell OpenMP not to share variables by default within a parallel region by using #pragma omp parallel default none But is there a way to set this globally? It seems as though the global default is that everything that isn't declared private is shared, and, at least in my application, there are many more things that should be private than should be shared. 回答1: All variables in OpenMP are shared by default. If you want a set of private variables you will need to specify these

Giving access to shared memory after child processes have already started

时光怂恿深爱的人放手 提交于 2019-11-28 08:32:15
How do I give child processes access to data in shared memory if the data is only available after the child processes have been spawned (using multiprocessing.Process )? I am aware of multiprocessing.sharedctypes.RawArray , but I can't figure out how to give my child processes access to a RawArray that is created after the processes have already started. The data is generated by the parent process, and the amount of data is not known in advance. If not for the GIL I'd be using threading instead which will make this task a little simpler. Using a non-CPython implementation is not an option.

Good alternative to shared memory IPC for Java/C++ apps on Linux

我与影子孤独终老i 提交于 2019-11-28 07:44:40
I'm currently using shared memory for IPC between Java and C++ apps, but looking for a more convenient alternative. Can someone advise a better method with same performance and speed? Thanks! mikelong It depends on how you plan to have your apps interact. In the POSIX environment, you have pipes, shared memory, sockets, semaphores and message queues. See this question: Comparing unix linux IPC for more information. What is the interaction model for your processes (i.e. client/server, producer-consumer, etc)? From personal experience, I would suggest your best bet would be pipes (since they are

How to create semaphores in shared memory in C?

霸气de小男生 提交于 2019-11-28 07:21:51
问题 My task is to create two different C files and then use the semaphores for process synchronization (I run both C files simultaneously). My main concern is: if I want to access the semaphores in both the processes (executables of the C files), I need to create the semaphores in shared memory. Also I need to create binary semaphores. As it is my first program, can someone suggest how to get started on this? I am able to create and use shared memory, used semaphores within the threads. I watched

What does the shmop PHP extension do?

扶醉桌前 提交于 2019-11-28 06:59:09
http://www.php.net/manual/en/intro.shmop.php Shmop is an easy to use set of functions that allows PHP to read, write, create and delete Unix shared memory segments. I don't understand, what exactly is the purpose of this extension? What is it used for? outis Shared memory allows multiple processes to access the same data in memory. You can use it to share data among running PHP scripts. $shm = shmop_open(0xF00, "c", 0644, 4); $count = unpack('L', shmop_read($shm, 0, 4)); $count = reset($count); var_dump($count); echo "count: ", $count++, "<br/>\n"; shmop_write($shm, pack('L', $count), 0); When

Sharing memory between processes through the use of mmap()

本秂侑毒 提交于 2019-11-28 06:53:48
I'm in Linux 2.6. I have an environment where 2 processes simulate (using shared memory) the exchange of data through a simple implementation of the message passing mode. I have a client process (forked from the parent, which is the server) which writes a struct(message) to a memory mapped region created (after the fork) with: message *m = mmap(NULL, sizeof(message), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0) This pointer is then written to a queue (in form of a linked list) into another shared memory area which is common to server and client process (because if was created prior

Shared memory between C++ and Java processes

不想你离开。 提交于 2019-11-28 06:28:46
My aim is to pass data from a C++ process to a Java process and then to receive a result back. I have achieved this via a named pipe but I would prefer to share the data rather than passing or copying it, assuming the access would be faster. Initially, I thought of creating a shared segment in C++ that I could write to and read with Java, but I'm not sure if this is possible via JNI, let alone safe. I believe it's possible in Java to allocate the memory using ByteBuffer.allocateDirect and then use GetDirectBufferAddress to access the address in C++, but if I'm correct this is for native calls

POSIX shared memory and semaphores permissions set incorrectly by open calls

。_饼干妹妹 提交于 2019-11-28 05:44:45
问题 I'm trying to create a shared memory which will be used by several processes, which will not necessarily be started by the same user, so I create the segment with the following line: fd = shm_open(SHARE_MEM_NAME,O_RDWR | O_CREAT,0606); however, when I check out the permissions of the file created in /dev/shm they are: -rw----r-- 1 lmccauslin lmccauslin 1784 2012-08-10 17:11 /dev/shm/CubeConfigShare not -rw----rw- as I'd expected. the permissions for /dev/shm are lrwxrwxrwx. The exact same

share dict between processes

拥有回忆 提交于 2019-11-28 05:21:32
问题 I spawn a seperate process to handle my cloud services. I spawnb it like this: CldProc = Process(target=CloudRun) CldProc.start() and am wondering if I can have a shared dictionary between that CloudProc and my current main process? EDIT: Alternatively I am thinking to use pickle to dump my data into a file from the process and load it back, this requires me to use join() to wait for the process to complete and exit. 2nd EDIT So, I now have my dict declared like mac_dict={} and then I fill it