shared-memory

How to implement a hello world shared memory in c/c++ in windows?

Is shared memory stable at the first place? I prefer this way to inter-process/application communication because that way I don't need the overhead of parsing data. Is there a good hello world demo on this in c/c++? ...

Java concurrency question

Possible Duplicate: Thread safety in Java class I'm reading Java concurrency in Practice (good book so far), and I've come to an example that puzzles me. The authors state that this class is not threadsafe public class MutableInteger{ private int number; public int getInt(){return number;} public void setInt(int val...

Slow shared memory performance when moved to 64-bit OS

I am having an issue with a 32-bit legacy app running on 64-bit windows. The app in question uses CreateFileMapping to create shared memory. When this is run on 64-bit Windows any attempt to access this shared memory from another process takes about 1 second. The shared memory is created using page protection flags: flProtect = PAGE_REA...

Python: quickly loading 7 GB of text files into unicode strings

I have a large directory of text files--approximately 7 GB. I need to load them quickly into Python unicode strings in iPython. I have 15 GB of memory total. (I'm using EC2, so I can buy more memory if absolutely necessary.) Simply reading the files will be too slow for my purposes. I have tried copying the files to a ramdisk and th...

Whats the difference between the two command lines? (SegFault)

I have written a code that maps to a shared memory location,so that the first program opens a shared memory block and stores some data in it.And the second program reads the shared data. Whats the difference between the two command lines: 1. if(argc<2) { printf("USAGE:%s text-to-share\n",argv[0]); } This code gives me a Segm...

How can I ensure that a class has no virtual methods?

I have a class whose objects are used in shared memory. Therefore, I must be sure that they do not have virtual methods (which crash the program when called via vtable). I would like to guard against anybody accidentally adding a virtual method in violation of this requirement. Ideally, the compiler would refuse to even compile the clas...

Keeping persistent data in memory

I am about to develop a Windows service in C#. This service needs to keep track of events in the system, and write some data to files from time to time. These ongoing events form a certain state, so I'll keep the state in memory and update it as events will arrive. I don't want to over-complicate things so I don't want the state to be pe...

Inserting pages into large mmap() files without copying data

I'm wondering if there is a way to insert blank pages near the beginning of a large (multi-GB) file that I have open with mmap(). Obviously it would be possible to add a page or two to the end, and move everything forward with memcpy(), but this would dirty every page and require an awful long time when eventually flushed to disk. I'm ...

gui implementation approach in c# and .NET

Hi, I am a complete begginer in C# and .NET. I am supposed to implement a GUI for a back-end process in C#. The design I am required to follow, is to have a datagrid to display the data and as users click on rows, other representations appear.E.g. a graph of the data. The gui is managed by a process, e.g. ProcessA. Another process, e.g....

Sharing a common memory area in Delphi between PCs

I have a Delphi 2006 app that gathers data and displays it as a summary of many channels, one channel per row on a TDrawGrid. I have the same app running on various other PCs on the network, but these other PC's are slaves - they don't gather data but merely provide a remote display of the summary. At present, the slaves just show a mi...

shared memory is not shared between processes

Hi, I am writing a server program where it receives message from client and broadcast message to all previous clients. I need to create a shared memory between processes, but it seems that the shared memory is not working. Here is my code: int shmid2; key_t key2; void* shm2; string name_list; key2=ftok("tmp",'d'); //create if ((...

opencv matrix into shared memory

Hi! I want to share between two linux processes a CvMat object (a matrix in the OpenCV library), for that I'm using shared memory. One process (server) will capture a frame (matrix) from the webcam, convert it to gray scale, share it using shared memory and show the frame on the screen. The other process (client) will read the shared fr...

Getting offset_ptr of object in shared memory

How can i access the offset_ptr of the object which is created in the shared memory? segment = new managed_shared_memory(create_only, "MySharedMemory", segmentSize); line = segment->construct<Line>("Line1")("line"); I want to access of offset_ptr for Line object.. ...

How can a thread function access variables of the parent thread

I read that threads share the memory address space of it's parent thread. If that is true , why can't a thread function access a local variable belonging to it's parent thread ? void* PrintVar(void* arg){ printf( "%d\n", a); } int main(int argc, char*argv[]) { int a; a = 10; pthread_t thr; pthread_create( &thr, NULL, Pri...

OpenMP and shared structures and pointers

I have a function which is passed two structures by reference. These structures are composed of dynamically allocated arrays. Now when I try to implement OpenMP I'm getting a slowdown not a speedup. I'm thinking this can be attributed to possible sharing issues. Here's some of the code for your perusal (C): void leap(MHD *mhd,GRI...

Interaction of fork and user-space memory mapped in the kernel

Consider a Linux driver that uses get_user_pages (or get_page) to map pages from the calling process. The physical address of the pages are then passed to a hardware device. Both the process and the device may read and write to the pages until the parties decide to end the communication. In particular, the communication may continue usin...