shared-memory

Shared Memory with Docker containers (docker version 1.4.1)

走远了吗. 提交于 2020-01-09 07:38:08
问题 I have 1 process that writes to a specific section of shared memory (i.e. "/falcon" )in a docker container. Docker image: dockersharedmemory/shmclient I have another process that initially creates and reads the same section of shared memory(i.e. "/falcon" ) every second in another docker container. Docker image: dockersharedmemory/shmserver When I run the two containers using the following commands I am able to read and write in each container respectfully: docker run -d -v /dev:/dev

Communication using Shared Memory between VC++ and Qt applications

时光总嘲笑我的痴心妄想 提交于 2020-01-06 20:01:36
问题 I am using FileMapping for implementing shared memory concept in a C++ windows form application and QSharedMemory in Qt application. I want to read data written by C++ form application using FileMapping technique, in Qt application using QsharedMemory. Is it possible? If not please suggest appropriate methods to implement this feature. 回答1: I'm not quite sure of the detail of your implementation, however I would suggest that a better more uniform way to approach this would be by using boost:

Boost interprocess flat_map operator[] compilation errors

隐身守侯 提交于 2020-01-06 19:05:29
问题 I'm building some wrapper over the boost::interprocess::flat_map, the problem is, that i'm unable to use operator[] or at for some reason. When i'm using find or insert it compiles succesfully. typedef boost::interprocess::managed_shared_memory::segment_manager SegmentManager; typedef boost::interprocess::allocator<char, SegmentManager> CharAllocator; typedef boost::interprocess::basic_string<char, std::char_traits<char>, CharAllocator> ShmString; typedef short KeyType; typedef ShmString

Use Linux to share continous RAM between processors

若如初见. 提交于 2020-01-06 06:07:56
问题 I am working with the Zynq 7 of Xilinx. On the Zynq there is a FPGA, an ARM processor and 512 MiB of DDR RAM. When the board is powered on, the ARM processor starts Ubuntu, which initializes the DDR RAM and claims it as its own. On the FPGA, I am developping another processor and I want to give it a piece of DDR memory. Since I am still developing, I would like to somehow allocate a piece of 64 MiB of continous DDR RAM from linux userspace (the device has a MMU). I would then get the start

Garbage collector in Ruby 2.2 provokes unexpected CoW

那年仲夏 提交于 2020-01-06 03:10:08
问题 How do I prevent the GC from provoking copy-on-write, when I fork my process ? I have recently been analyzing the garbage collector's behavior in Ruby, due to some memory issues that I encountered in my program (I run out of memory on my 60core 0.5Tb machine even for fairly small tasks). For me this really limits the usefulness of ruby for running programs on multicore servers. I would like to present my experiments and results here. The issue arises when the garbage collector runs during

== with Abstract datatypes, different results for the same kind of conditions [duplicate]

谁都会走 提交于 2020-01-05 07:20:12
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Integer wrapper objects share the same instances only within the value 127? public class test { public static void main(String args[]) { Integer a1=127; Integer a2=127; System.out.println(a1==a2); //output: true Integer b1=128; Integer b2=128; System.out.println(b1==b2); //output: false Long c1=127L; Long c2=127L; System.out.println(c1==c2); // output: true Long d1=128L; Long d2=128L; System.out.println(d1==d2);

Is there a way to determine if free() would fail?

橙三吉。 提交于 2020-01-05 02:35:53
问题 Is there a way to determine if free() would fail if ever called on a certain memory block pointer? I have the following situation: a thread having access to a shared resource fails whilst it may have been in the state of freeing the said resource. Now I need to devise a safe way to clean-up this shared resource. Of course I have assigned ownership of the resource for the normal case but what about the aforementioned limit case? UPDATED: If I use additional synchronizing mechanisms it only

Is there a way to determine if free() would fail?

假如想象 提交于 2020-01-05 02:35:29
问题 Is there a way to determine if free() would fail if ever called on a certain memory block pointer? I have the following situation: a thread having access to a shared resource fails whilst it may have been in the state of freeing the said resource. Now I need to devise a safe way to clean-up this shared resource. Of course I have assigned ownership of the resource for the normal case but what about the aforementioned limit case? UPDATED: If I use additional synchronizing mechanisms it only

c programming shmat ( ) permission denied

泪湿孤枕 提交于 2020-01-04 09:48:10
问题 I have a problem when I run my code. My shmat fails and prints permission denied. I searched on google how to solve it but I can't. My code is the following: #include <stdio.h> #include <sys/ipc.h> #include <sys/shm.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #define ERROR -1 int main ( int argc, char *argv[] ) { int shmid,key=50; int *val; int *x; int rw = -1; // 0 for write and 1 for read shmid = shmget ( key, sizeof( int ), IPC

synchronization between processes using unnamed semaphores

雨燕双飞 提交于 2020-01-04 05:55:44
问题 In process-1 I am trying to write the data into shared memory. At the same time in process-2 I am reading the data from the same shared memory. in this case I need to provide synchronization between these two processes. if I will go through unnamed semaphores (using shm_init(),mmap() ),will it work or not? I have written code like this will it work or not? fd = shm_open("shm_name", O_CREAT| O_RDWR, S_IRUSR | S_IWUSR); sema = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE,MAP_SHARED , fd, 0)