All Questions
Tagged with shared-memory semaphore
161 questions
0
votes
2
answers
179
views
C semaphore and shared memory
I'm trying to develop the classic producer-consumer circular buffer example with one producer and one consumer respectively.
However I'm having some problems that I can't figure out where they come ...
0
votes
1
answer
73
views
Server-Clients model using shared memory
I have the following program and can't make it to proper synchronization between clients and server.
After running , my program always ends up in collision between a client and a server trying to ...
1
vote
1
answer
53
views
Child process doesn't modify statistics in parent process
I'm working on a C application that involves multiple processes, both child processes and the parent process, and I'm trying to share statistics between them using shared memory and semaphores. ...
0
votes
1
answer
88
views
Unable to call sem_trywait function in consumer process while able to get POSIX semaphore value
I am currently trying to solve issue with my multi-process project. In the process called sender(file sender.c, producer) I am able to modify unnamed semaphore value bu using sem_wait and sem_post ...
0
votes
1
answer
273
views
Writing into shared memory while semaphore value is 0 causes program to freeze in C, ubuntu
I'm writing a multi-process project for a university assignment in operating systems and I've come across a strange issue. Writing into a specific part of shared memory while the semaphore value is 0 ...
0
votes
1
answer
154
views
How to get correctly the semaphore from shared memory
I have a library that write in an array stored in shared memory. Now, I want to synchronize the process because there will be more process that can access and put element in this array. I'm studying ...
1
vote
1
answer
543
views
How to wait until shared memory is initialized by other process?
I have two processes, A and B, that are using shared memory. I want process B to wait to use the shared memory until it is completely initialized by process A. To coordinate this, I am attempting to ...
0
votes
1
answer
499
views
Message queue using shared memory/semaphore, how to check if if there is no process connected to the queue?
typedef struct
{
char data[MESSAGE_SIZE];
} MESSAGE;
typedef struct
{
sem_t sem_send;
sem_t sem_receive;
MESSAGE messages[];
} MQ;
Currently working on message queue, I want to ...
0
votes
1
answer
229
views
Multiple tests in shared memory between parent and child in C
I am writing a program that does multiple writing and reading tests between a parent and a child processes (One of them has the work of writing in a shared memory block and the other one has the work ...
2
votes
0
answers
315
views
Where and how are semaphores in PHP stored
I am curious about where and how PHP stores semaphores in context of sharing them within the application.
From what I was able to understand from documentation, they use shared memory.
Since ...
0
votes
1
answer
400
views
Semaphores and shared memory already opened / Problem with O_EXCL flag
I'm currently working on a programm that has a shared memory and semaphores. However I have issues with initializing them. Whenever I wanna open them (whilst having the O_EXCL flag active I keep ...
2
votes
2
answers
730
views
How to use semaphores without thread and fork?
I'm currently working on a school projet (C language) which aims to make processes who can write into shared memory, one by one.
I can't use multi-threading neither fork.
I can have only one ...
0
votes
2
answers
256
views
Semaphore deadlock when using unnamed semaphores in POSIX with shared memory
I have 2 semaphores. I have a shared memory segment. I am trying to synchronize processes so that they wait for each other until a certain task is finished but when sem_post_util( sem_sync ) is used ...
0
votes
0
answers
384
views
How do I use semaphore as share variable (share memory) in Producer/Consumer problem in C
I have been trying to use semaphore in my producer/consumer problem but I couldn't figure out how to declare semaphore and mutex lock in shared memory and use them across two processes. My current ...
0
votes
0
answers
204
views
POSIX semaphores - cannot determine what causes segmentation fault
I'm working on the sleeping barber problem (using FIFO queue and shared memory), and I have a problem. I try to run this program just to see what is shown, however, I get segmentation fault every time....