Hot answers tagged ipc
17
This depends a lot on the communication mechanism.
At the most transparent end of the spectrum, processes can communicate using internet sockets (i.e. IP). Then wireshark or tcpdump can show all traffic by pointing it at the loopback interface.
At an intermediate level, traffic on pipes and unix sockets can be observed with truss/strace/trace/..., the ...
6
Historically, Unix had only these two signals, but modern systems have the real-time signals SIGRTMIN...SIGRTMAX.
Due to the wacky and unportable semantics of the signal APIs, there is almost no use case where signals would be preferrable over other communication mechanisms like pipes. Therefore, allocating a new signal number has never been seen as ...
4
If you read the manpage for semget, in the Notes section you'll notice:
System wide maximum number of semaphore sets: policy dependent (on Linux, this limit can be read and modified via the fourth field of /proc/sys/kernel/sem).
On my system, cat /proc/sys/kernel/sem reports:
250 32000 32 128
So do that on your system, and then echo it back after ...
4
Yes, a pipe made with pipe() has two file descriptors. fd[0] for reading and fd[1] for writing.
No, you do not have to close either end of the pipe, it can be used for bidirectional communication.
Edit: in the comments you want to know how this relates to ls | less, so I'll explain that too:
Your shell has three open file descriptors: 0 (stdin), 1 ...
3
UNIX domain sockets and FIFO may share some part of their implementation but they are conceptually very different. FIFO functions at a very low level. One process writes bytes into the pipe and another one reads from it. A UNIX domain socket has the same behaviour than a TCP/IP socket.
A socket is bidirectionnal and can be used by a lot of processes ...
2
ls will output what it has to output on its standard output. To do that, it calls the write system call, something like:
write(1, "file1 file2...\n", 16)
(or more likely it calls libc functions like printf or fwrite that eventually do the write() system call)
It assumes that the file descriptor 1 (stdout by convention) was already opened and points to ...
2
Typically the parent process waits until the child process ends by calling waitpid. The parent process gets the PID of the process from fork.
This means the child never signals the parent process in any way that it exited or what happened. This is done by the system and not the child process.
If you are talking about the output of the program, the parent ...
2
Signals only provide a primitive means of communication. In particular, there's no way to attach any information to them. The recipient only knows the signal number, not the identity of the sender. Multiple signals can be conflated into one. Given all these restrictions, there aren't that many useful purposes for signals.
For more complex purposes, use more ...
2
This will show what a process reads and writes:
strace -ewrite -p $PID
It's not clean output (shows lines like: write(#,) ), but works! (and is single-line :D ) You might also dislike the fact, that arguments are abbreviated. To control that use -s parameter that sets the maxlength of strings displayed.
It catches all streams, so You might want to filter ...
2
Finding the transport
Try using netstat -ln | grep 'mysql' and you can see how it is connected by the output. if you have access to shell
On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to ...
1
There is no command I know of but there exists a libc function call which can get the statistics:
man 3 mq_getattr
mq_getattr() returns an mq_attr structure in the buffer pointed by
attr. This structure is defined as:
struct mq_attr {
long mq_flags; /* Flags: 0 or O_NONBLOCK */
long mq_maxmsg; /* Max. # ...
1
Just some pointers on how to (possibly) talk with the power daemon.
Have a look into the Chromium OS sources (no idea on how much this differs from Chrome OS), there you'll find the power_managers sources which might be helpful:
README explains what one can find there, among others:
powerd (powerd.cc)
Upper power manager. Adjusts device status ...
1
The only way you could handle this would be to have some kind of heartbeat system between the processes. For instance the first process could share its PID in shared memory.
Subsequent processes could announce themselves by sending a signal such as SIGUSR1. Then they could keep sending SIGUSR2 at intervals as a heartbeat. Two missing SIGUSR2 signals in a ...
Only top voted, non community-wiki answers of a minimum length are eligible

