Questions tagged [sysv-ipc]

System V IPC, now XSI interprocess communication, provide IPC facilities with message queues, semaphores and shared memory segments.

System V IPC (SysV IPC for short) is one of the communication mechanisms on Unix systems. They are standardized as part of the XSI extension to POSIX. The API comprises three facilities are message queues (sys/msg.h), semaphore arrays (sys/sem.h) and shared memory segments (sys/shm.h).

Not to be confused with the many other types of IPC facilities, in particular POSIX message queues (mq_xxx functions), POSIX semaphores (sem_xxx functions) and POSIX shared memory object (shm_xxx functions).

50 questions
14
votes
5 answers

What are the disadvantages of Linux's message queues?

I am working on a message queue used to communication among process on embedded Linux. I am wondering why I'm not using the message queues provided by Linux as following: msgctl, msgget msgrcv, msgsnd. instead of creating shared memory, and sync up…
Joe.Z
  • 2,725
  • 4
  • 25
  • 30
8
votes
1 answer

Equivalent of Sys V SEM_UNDO for posix semaphores

In a Linux system with multiple processes system V semaphores allow an option of SEM_UNDO preventing a semaphore from getting "stuck" if a process holding the semaphore crashes. What is the correct method to prevent POSIX semaphores getting jammed…
Joe
  • 7,378
  • 4
  • 37
  • 54
6
votes
3 answers

Ada POSIX binding and several set of POSIX interfaces for IPC

I'm taking a look to the standard Ada POSIX binding, and the Florist implementation for GNAT. The aim is evaluating if a legacy application can be ported from its own use of pragma Import of the C POSIX functions to use the standard binding. The…
Gneuromante
  • 560
  • 3
  • 12
5
votes
3 answers

PHP sem_get function fails

I have implemented an access control for insertions into a database table that is used for a reservation service. It works fine for some time, then the sem_get() function fails despite the fact that I call sem_release() after every sem_get(). case…
JokerDev
  • 151
  • 2
  • 15
5
votes
1 answer

System V semaphore multiple increment/decrement

I was reading the difference between POSIX and System V semaphores, and I read some articles on the same. In each article this statement is written : "System V semaphores are beneficial if you need to implement atomic operations with multiple…
Sahil
  • 51
  • 4
5
votes
3 answers

Need to increase buffer for IPC message queue in OpenWRT

I'm just learning how to use message queues, and I am having a little difficulty with them. I am using two completely separate applications to do the testing -- one is the "sender", and the other is the "receiver". When I run the sender, it sends…
Dave
  • 14,618
  • 13
  • 91
  • 145
4
votes
3 answers

Reading from message queue (non-blocking if empty)

I'm writing to message queue if (msgsnd(q, &msg, sizeof(message), slaves_list[to]) == -1) and reading if (msgrcv(q, &msg, sizeof(message), id, 0) == -1) but what if this queue is empty? How to check that? If there is nothing I want execute next…
OnTheFly
  • 2,059
  • 5
  • 26
  • 61
3
votes
2 answers

Synchronizing message queue between processes

I'm trying to implement a program that has a producer and N (N >= 1) workers. They communicate using a message queue. The idea is that the producer sends to the queue "tasks". The workers do a msgrcv() call to get a task and execute some code. After…
David S.
  • 33
  • 1
  • 3
3
votes
3 answers

Perl: Parameters to msgsnd

I am maintaining some existing code I see this fragment: msgsnd( $mQueue, pack("l! a*", length($msg), $msg), 0) || ... error handling ... I would like to understand the call to pack() as the second argument to…
djna
  • 54,992
  • 14
  • 74
  • 117
3
votes
2 answers

Detaching from shared memory before removing it

When I have several processes going on using a shared memory, and I detach all of them but one. Does it make sense to detach the last process before removing the shared memory with shmctl() (with that process)? If it doesn't make sense, is it…
Raz Moshe
  • 59
  • 1
  • 6
3
votes
1 answer

Linux System V IPC: Unable to initialize semaphore value

I have created a simple semaphore initialization example for demo purpose: #include #include #include #include #include #include int init_semaphore(int semid, int semnum, int…
Naveen
  • 7,944
  • 12
  • 78
  • 165
2
votes
1 answer

What is the relationship of a shmget buffer and semget semaphore with the same key?

I'm trying to understand the implications of using the same System V key_t value for allocating a shared memory buffer via shmget() and a semaphore via semget(). Does this present any conflict, i.e. should I assign a separate key value for the…
Vercingatorix
  • 1,838
  • 1
  • 13
  • 22
2
votes
1 answer

Shmget error for shared memory of a matrix

Context of the code: Hello, I am trying to create a program that can multiply two 2x2 matrixes using separate processes (child1 and child2). Specifically child1 processes row1 of the resulting matrix and child2 processes row2 of the resulting…
Rambus
  • 21
  • 2
2
votes
2 answers

Difference between EIDRM and EINVAL errno from semop call

I was testing some code using Sys V Semaphores for its ability to recover from various events, and for one such test, I deleted the semaphore set (from the terminal) while the process was in its critical section. When it came time to release the…
Christian Gibbons
  • 4,272
  • 1
  • 16
  • 29
2
votes
1 answer

Using System V semaphores under Cygwin: Bad system call

I'm having a problem with POSIX Semaphores under Cygwin, I've tried the following: $ semtool c 1 Attempting to create new semaphore set with 1 members Bad system call $ the semtool above tries to create (via semget, semctl etc sys. calls) a new…
cygwinner
  • 23
  • 1
  • 4
1
2 3 4