All Questions
Tagged with shared-memory semaphore
161 questions
39
votes
11
answers
116k
views
Delete all SYSTEM V shared memory and semaphores on UNIX-like systems
How can I delete all not used semaphores and shared memory with a single command on a UNIX-like system, e.g., Ubuntu?
27
votes
2
answers
56k
views
How to use POSIX semaphores on forked processes in C?
I want to fork multiple processes and then use a semaphore on them. Here is what I tried:
sem_init(&sem, 1, 1); /* semaphore*, pshared, value */
.
.
.
if(pid != 0){ /* parent process */
...
13
votes
1
answer
2k
views
Why does PHP's sem_acquire blocks program execution?
I am working on a very large and complex PHP project running on gentoo Linux which obviously has some issues with PHP semaphores. Because of the size and complexity of the project I cannot post the ...
10
votes
3
answers
22k
views
Do forked child processes use the same semaphore?
Let's say I create a semaphore. If I fork a bunch of child processes, will they all still use that same semaphore?
Also, suppose I create a struct with semaphores inside and forked. Do all the ...
10
votes
2
answers
29k
views
How to create semaphores in shared memory in C?
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 ...
8
votes
1
answer
4k
views
Using shared memory with fork()
I already looked at the only similar post I could find, but it wasn't what I was looking for.
Basically, I'm trying to run the Odd-Even Sort with forking, so the child runs odds and parent runs the ...
7
votes
1
answer
425
views
semaphore keys lost after some time
I have a parent-child processes using shared memory.
Child put data into shared memory about 10 times per second.
Parent and child are using semaphore to lock resource while writing/reading.
This ...
4
votes
2
answers
4k
views
what is difference between semaphore and shared memory
What is difference between semaphore and a shared memory ?
can I use semaphores between two different processes or it must be used only in threads of a same process ?
4
votes
2
answers
2k
views
Segmentation fault when using semaphores with POSIX shared memory
I have a problem with some simple code I'm writing to teach myself about semaphores and POSIX shared memory.
The idea is that one program, the server, opens the shared memory and writes a structure (...
4
votes
1
answer
802
views
Right strategy with shared memory and semaphore removing in RAII like php class
When such situation occurs?
If your are using shared memory and semaphores for interpocess locking (with pcntl extension) you should care about semaphore and shared memory segment life circle. For ...
4
votes
2
answers
2k
views
Does Mach semaphore work in shared memory between processes?
I'm interested in using a semaphore, created using semaphore_create(task, sem, policy, value) from mach/semaphore.h, in a shared memory to synchronize two processes in Mac OS.
I know that on Linux ...
4
votes
1
answer
396
views
What is the best kind of diagram to illustrate the workings of a semaphores / multiprocess / shared memory program?
I have made a small project in which I have used various processes / shared memory / semaphores.
I am now going to have to explain my code and the program logic to both my lecturer and a couple of ...
3
votes
3
answers
4k
views
Looking for good analogy/examples for monitor verses semaphore
A monitor is supposed to solve problems with semaphores in concurrent environments.
I'm looking for a good analogy using a monitor verses semaphore.
Please use information for the analogy:
4 tasks (...
3
votes
1
answer
2k
views
Where do you place POSIX semaphores when using POSIX shared memory?
I'm trying to build a client server application using POSIX shared memory and POSIX semaphores. Do I have to place the semaphores inside the shared memory segment or can the semaphores just be global ...
3
votes
1
answer
2k
views
Asynchronous Shared Memory Read/Write
In my application, I am using shared memory for IPC between parent and child (on both Linux and Windows). Full code for Linux is at https://github.com/devendermishra/SharedMemoryTest/blob/master/...