shared-memory

How do I synchronize access to shared memory in LynxOS/POSIX?

不打扰是莪最后的温柔 提交于 2019-12-28 05:31:09
问题 I am implementing two processes on a LynxOS SE (POSIX conformant) system that will communicate via shared memory. One process will act as a "producer" and the other a "consumer". In a multi-threaded system my approach to this would be to use a mutex and condvar (condition variable) pair, with the consumer waiting on the condvar (with pthread_cond_wait ) and the producer signalling it (with pthread_cond_signal ) when the shared memory is updated. How do I achieve this in a multi-process,

How to put a variable in a shared memory? [duplicate]

谁都会走 提交于 2019-12-25 18:36:05
问题 This question already has answers here : how to use shared memory to communicate between two processes (3 answers) Closed 2 years ago . I have a variable with a value and I want to share it with the proccesses. Ex: typedef struct { unsigned int a; unsigned int b; another_struct * c; } struct1; ... struct1 A ={...}; ... Now, I want to create a shared memory region and put the A variable in this region. How can i do this? 回答1: Shared memory is an operating system feature (which does not exist

create shared memory around existing array (python)

时光毁灭记忆、已成空白 提交于 2019-12-25 08:59:41
问题 Everywhere I see shared memory implementations for python (e.g. in multiprocessing ), creating shared memory always allocates new memory. Is there a way to create a shared memory object and have it refer to existing memory? The purpose would be to pre-initialize the data values, or rather, to avoid having to copy into the new shared memory if we already have, say, an array in hand. In my experience, allocating a large shared array is much faster than copying values into it. 回答1: The short

Semaphores and shared memory

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 08:05:46
问题 I have a question regarding multiprocess programming in C, I have several reader processes that will be reading from a file into a shared buffer and several writer processes reading from the buffer and into another file, what type of semaphores will we need to use for this. and how can we use shared memory with the semaphores. 回答1: If you're on linux, one easy option is to use pshared mutexes and condition variables. A recet version of glibc will be necessary. Essentially inside your shared

Semaphores for fortran

蹲街弑〆低调 提交于 2019-12-25 06:49:52
问题 Can anyone help with writing a semaphore function in fortran? I have multiple processes running and I have to synchronize them using semaphore. Such a code could be found for C++ etc., but I could not find any such code for fortran. If I could call C/C++ function from fortran code, that would also suffice, since C++ semaphore function is already there. PS: (Additional Explanation) Here is the code which works for C++. I have some fortran applications (as part of standard benchmark) but no

How to remove an object from NSMutableArray only when retain count reaches 0?

纵然是瞬间 提交于 2019-12-25 06:34:12
问题 I know I'm not supposed to check or use retainCount, but I'm trying to wonder if there's a way to have an object be removed from an NSMutableArray only after its retain count is 0. Basically, I want to add objects to an array, and have those objects be shared among other windows. When a window uses it, I want the retain count to go up by 1. When it's no longer used, I want it to go down. But, if some window is still using it, then I want it to be available to all other windows. When all

PostgreSQL 8.3.7: “FATAL: could not reattach to shared memory” and “WARNING: worker took too long to start; cancelled”

徘徊边缘 提交于 2019-12-25 06:01:14
问题 We record our office IP phone activity using Xima software's Chronicall, which uses a PostgreSQL backend. The server on which both of these are installed is an ESXi 5.5 VM running Windows Server Standard 2008 SP1. For some time now, we have been getting the following PostgreSQL errors in Windows event viewer: "FATAL: could not reattach to shared memory (key=248, addr=02510000): 487" "WARNING: worker took too long to start; cancelled" These errors occur every hour or two, and always occur back

PostgreSQL 8.3.7: “FATAL: could not reattach to shared memory” and “WARNING: worker took too long to start; cancelled”

天涯浪子 提交于 2019-12-25 06:00:20
问题 We record our office IP phone activity using Xima software's Chronicall, which uses a PostgreSQL backend. The server on which both of these are installed is an ESXi 5.5 VM running Windows Server Standard 2008 SP1. For some time now, we have been getting the following PostgreSQL errors in Windows event viewer: "FATAL: could not reattach to shared memory (key=248, addr=02510000): 487" "WARNING: worker took too long to start; cancelled" These errors occur every hour or two, and always occur back

Reasons a user might not be able to open a shared memory object on Linux systems

元气小坏坏 提交于 2019-12-25 04:42:46
问题 I'm having some trouble with an application I'm supporting that, for various annoying reasons, forks worker processes to handle some tasks. These processes communicate status and sometimes results using a shared memory space. I'm using the boost interprocess library to accomplish this (using shared_memory_object and mapped_region types). On one of the systems deployed to we have extremely limited access, making debugging on that system difficult. There's a whole process just to get a new

client get segmentation fault when attach to shared memory

十年热恋 提交于 2019-12-25 01:39:43
问题 Hi i want to implement a client-server program that communicates with each other via shared memory. in the server side i have two threads. a writer thread and a reader thread. the writer thread puts some data into the queue and the reader thread reads from it and passes the data to the client side via shared memory.each client that has shmid can attach itself to it and read data from it... right now i get segmentation fault at client side when it comes to attach to shared memory. here is my