shared-memory

shared memory mutex with struct pointers

强颜欢笑 提交于 2020-01-16 08:43:33
问题 Im looking for some feedback on if I am doing the following properly. Im working on porting some windows real time code that had heavy use of named mutex's. It took some searching but i came across some stuff saying you can use shared memory as mutexes in linux, using shm open. I cant include all of the code here, but i put together the key areas that i need some feed back on. My questions are if im setting up the shared memory region, and mutex correctly, and also if my pointers will be set

shared memory mutex with struct pointers

社会主义新天地 提交于 2020-01-16 08:43:08
问题 Im looking for some feedback on if I am doing the following properly. Im working on porting some windows real time code that had heavy use of named mutex's. It took some searching but i came across some stuff saying you can use shared memory as mutexes in linux, using shm open. I cant include all of the code here, but i put together the key areas that i need some feed back on. My questions are if im setting up the shared memory region, and mutex correctly, and also if my pointers will be set

pointer returned by shmat points at the end of address space which gives seg fault

纵然是瞬间 提交于 2020-01-16 03:30:12
问题 //TeamSize is an integer int Seg_id = shmget(SHM_KEY,sizeof(Word)*TeamSize,IPC_CREAT); void* Seg_ptr = shmat(Seg_id,0,0); new(Seg_ptr) Word[TeamSize]; I am having trouble with this segment of code. The Word class is a class that I defined with 8 bytes char array and some parse functions. I think I am using shmget and shmat just like how others use them. But I keep getting seg fault. When I print out Seg_id, it looks normal just some number. But Seg_ptr points at 0xffffffffffffffff. Then the

web service asmx under IIS and shared memory

夙愿已清 提交于 2020-01-15 13:39:55
问题 I have a windows console application that use shared memory for communicate with other process, I need to share data with this process from a web service hosted on same machine. When I use visual studio development server all works fine, but I have FILE NOT FOUND ERROR (code 2 ) when I try to open a memory-mapped file from web service application under IIS 6.1. These are functions for create and open memory-mapped file, I think that IIS use a different memory space, is possible ? [DllImport(

web service asmx under IIS and shared memory

戏子无情 提交于 2020-01-15 13:38:51
问题 I have a windows console application that use shared memory for communicate with other process, I need to share data with this process from a web service hosted on same machine. When I use visual studio development server all works fine, but I have FILE NOT FOUND ERROR (code 2 ) when I try to open a memory-mapped file from web service application under IIS 6.1. These are functions for create and open memory-mapped file, I think that IIS use a different memory space, is possible ? [DllImport(

web service asmx under IIS and shared memory

懵懂的女人 提交于 2020-01-15 13:37:27
问题 I have a windows console application that use shared memory for communicate with other process, I need to share data with this process from a web service hosted on same machine. When I use visual studio development server all works fine, but I have FILE NOT FOUND ERROR (code 2 ) when I try to open a memory-mapped file from web service application under IIS 6.1. These are functions for create and open memory-mapped file, I think that IIS use a different memory space, is possible ? [DllImport(

How do I implement dynamic shared memory resizing?

故事扮演 提交于 2020-01-14 09:56:10
问题 Currently I use shm_open to get a file descriptor and then use ftruncate and mmap whenever I want to add a new buffer to the shared memory. Each buffer is used individually for its own purposes. Now what I need to do is arbitrarily resize buffers. And also munmap buffers and reuse the free space again later. The only solution I can come up with for the first problem is: ftuncate(file_size + old_buffer_size + extra_size), mmap, copy data accross into the new buffer and then munmap the original

How do I implement dynamic shared memory resizing?

泄露秘密 提交于 2020-01-14 09:56:07
问题 Currently I use shm_open to get a file descriptor and then use ftruncate and mmap whenever I want to add a new buffer to the shared memory. Each buffer is used individually for its own purposes. Now what I need to do is arbitrarily resize buffers. And also munmap buffers and reuse the free space again later. The only solution I can come up with for the first problem is: ftuncate(file_size + old_buffer_size + extra_size), mmap, copy data accross into the new buffer and then munmap the original

How do I memory map tmpfs files in sbcl?

笑着哭i 提交于 2020-01-14 08:08:43
问题 Exactly as the question says. I want to use shared memory to communicate between two lisp processes. Any pointers on how to do that? I can see some tutorials on doing this in clozure at :- http://ccl.clozure.com/manual/chapter4.7.html Can someone point me to a similar library to do this with sbcl? 回答1: For a portable implementation, you might want to use the osicat library, which provides a CFFI wrapper for many POSIX calls in the osicat-posix package. There is a very nice and short article

How can I share a dict between two different http requests

不想你离开。 提交于 2020-01-14 05:21:28
问题 The Django application loads data from a file to a Python dict, process it and sends it as http response. Now say n number of request are received on the web server then this Django app would run n times and load data from a file to a Python dict n times. I was wondering if somehow I can make this data being loaded to the dict only once while n http response could be served. An example view.py file for the problem situation can be as followed: from django.http import HttpResponse from django