Sponsored Content
Full Discussion: IPC Mechanisms
Top Forums Programming IPC Mechanisms Post 302431028 by Corona688 on Sunday 20th of June 2010 02:39:33 PM
Old 06-20-2010
Well, let's take a look at some situations where these things are used...

Shared memory avoids having to write data into and read it back out of the kernel, making it a blindingly fast way to share the same data with swarms of processes. Since it's not arbitrated by the kernel, it's got race conditions and pitfalls, so isn't as easy as it looks; when solving a complex enough problem you might find you're writing your own sockets from scratch instead of anything faster. You see it in situations with very demanding performance requirements, like high-performance audio or video interfaces(X11 drivers, XSHM video, DirectX). Linux's modern pthreads implementation builds mutexes and the like out of atomic operations on shared memory.

Named pipes are kind of an old-fashioned hack kept for portability reasons. Their behavior can be a bit obscure when dealing with more than one reader and/or writer. Occasionally handy in the shell to bridge unbridgables, otherwise I don't see them get much serious use.

UNIX domain sockets are very often used for local client/server interfaces because they're network-like(one server, multiple clients) without the overhead of loopback networking. Big things like X11 and MySQL servers serve clients with UNIX domain sockets when possible. Lots of less demanding system daemons and controllers(system loggers, linux udev, linux acpid, linux's wpa authentication manager) also use UNIX domain sockets for their convenience of network-like connect/disconnect without the complication of actual networking. They can't do any kind of sharing or broadcast sending.

pthreads is a threading implementation but often called (and used as) IPC anyway. Some implementations do allow seperate processes to share mutexes etc(the current NPTL linux implementation), some don't(linux's old linuxthreads implementation). Its features are tightly defined, fairly portable, and somewhat limited, mostly restricted to control mechanisms, not communication structures. By and large its overhead is quite low, but implementations of course vary. For simple control of threads it's difficult to beat.

System V IPC seems a bit overbuilt. Unlike POSIX thread primitives, this API is geared towards communications between unrelated processes, and frilled with so many features it's hard to imagine it not having significant overhead(most objects semi-persistent and given their own owner/group/attributes set, mtimes kept for many kinds of things, sometimes even last-user-modified). It has some interesting and difficult-to-implement features(grouping several semaphore operations atomically) which would be useful if implemented brilliantly, but can stall and starve if done badly, and implementations do vary. Message queues I'm unfortunately quite unfamiliar with.

Last edited by Corona688; 06-20-2010 at 04:13 PM..
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ipc

I have a parent that is passing data to child A and then child A has to process it and pass to child B. I am able to pass the data to child A but am not able to pass it to child B. Child B seems to only be receiving the last data instead of the whole data. I saw one example in a book but it uses... (1 Reply)
Discussion started by: scmay
1 Replies

2. UNIX for Dummies Questions & Answers

Data Transfer programs in IPC Mechanisms??

I have no IPC Mechanisms program which includes data transfer on the same Linu machine. All mechanisms of IPC must be tested. If anyone have programs about it, could you send to me?? I am waiting your answers. please help me...!!!! (2 Replies)
Discussion started by: boris35
2 Replies

3. UNIX for Dummies Questions & Answers

Ipc Details

hai, i am doing my masters degree in computers.please any one tell me about fork(),semaphores,mutex,messaging queues,messaging using pipes ,and msgget(),msgrecv() funtions in ipc programming . i have exam on that i have a book but in that they not given clearly. hope u will ... (2 Replies)
Discussion started by: G.Vishnuvardhan
2 Replies

4. Programming

IPC with PIPE

Hi guys, I'm new to Linux and Unix I have just simple code . But I don't know why it doesn't work .. But, the outputfile is Blank.. I don't understand why.. Please help me.. Thank you very much P.S: sorry, I don't know how to edit this post clearly.. it's hard to read.. Please try.. (2 Replies)
Discussion started by: thanh_sam_khac
2 Replies

5. Solaris

errors on Netra-440: "IPC Warning: ipc: tcp_protocol: bad magic number"

I was asked to look into a problem with a Sun Netra 440 in another department. On the server in question, the relevant 'uname -a' information is, "SunOS host1 5.9 Generic_118558-16 sun4u sparc SUNW,Netra-440". That information aside, while the other admin is logged into the ALOM, these errors are... (0 Replies)
Discussion started by: Borealis
0 Replies

6. UNIX for Dummies Questions & Answers

Mach IPC

hey everyone, I'm reading a tutorial on the Mach kernel principles, however, the port and port rights part are kind of confusing to me. I don't know if the book has typos or something but it seems a bit contradictory. It says that "ports, themselves, are not named. It is the port rights that are"... (10 Replies)
Discussion started by: neur0n
10 Replies

7. HP-UX

IPC settings on HP-UX

Hi Experts, Need your help for checking te interprocess communications settings on HP-UX box. Using ipcs command I am able to view Message queue,semapohores etc, but from that output I m not able to understand how to determine if there is any issue with ipc settings and how to resolve that? (1 Reply)
Discussion started by: sai_2507
1 Replies

8. Shell Programming and Scripting

help with IPC + thread

Actually i am thinking of some usefull application that involves both IPC and pthreads.But i am not quite sure what type of application involves both these together :confused:. Anyways i am now working on creating a simple featured file manager that can do the following: Display file name and... (2 Replies)
Discussion started by: ronmaximus
2 Replies

9. Shell Programming and Scripting

Are there any IPC mechanisms in cygwin?

I wonder are there any IPC mechanisms in cygwin? such as shared memory, semaphores , message queues and piping? Thanks Jack (2 Replies)
Discussion started by: lucky7456969
2 Replies

10. UNIX for Beginners Questions & Answers

Questions about IPC

Hello and thanks in advance for any help anyone can offer to help me understand this I'm curious about a 30.000 ft view on how IPC works in Linux between parent-child processes...I understand there's multiple types of IPC's... But I'm currently trying to figure out if parent-child process IPC... (1 Reply)
Discussion started by: bodisha
1 Replies
IPC(2)							     Linux Programmer's Manual							    IPC(2)

NAME
ipc - System V IPC system calls SYNOPSIS
int ipc(unsigned int call, int first, int second, int third, void *ptr, long fifth); DESCRIPTION
ipc() is a common kernel entry point for the System V IPC calls for messages, semaphores, and shared memory. call determines which IPC function to invoke; the other arguments are passed through to the appropriate call. User programs should call the appropriate functions by their usual names. Only standard library implementors and kernel hackers need to know about ipc(). CONFORMING TO
ipc() is Linux-specific, and should not be used in programs intended to be portable. NOTES
On a few architectures, for example ia64, there is no ipc() system call; instead msgctl(2), semctl(2), shmctl(2), and so on really are implemented as separate system calls. SEE ALSO
msgctl(2), msgget(2), msgrcv(2), msgsnd(2), semctl(2), semget(2), semop(2), semtimedop(2), shmat(2), shmctl(2), shmdt(2), shmget(2) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2007-06-28 IPC(2)
All times are GMT -4. The time now is 08:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy