1 |
On Friday 12 February 2010 04:24:33 walt wrote: |
2 |
> On 02/11/2010 03:03 PM, Volker Armin Hemmann wrote: |
3 |
> > ... |
4 |
> > |
5 |
> > And don't start with sockets. That will result in a nightmare. dbus is a |
6 |
> > clean solution to a huge problem. Apps have to talk to each other. The |
7 |
> > only way to keep it sane is a standardized IPC daemon like dbus. |
8 |
> |
9 |
> Aha! This is a question that has confused me since I was still in diapers. |
10 |
> (And may be in them again soon enough :) |
11 |
> |
12 |
> Could you (or anyone else here) give us a really dumbed-down summary |
13 |
> of why a dev would want/need to use a socket, versus a pipe, versus |
14 |
> a signal, versus dbus, versus, well, whatever else is out there? |
15 |
|
16 |
A pipe is a quick and dirty means of connecting two processes. Shove stuff in |
17 |
one end and it comes out the other end. What the other end does with it is up |
18 |
to the other end. A pipe (|) in a shell is the same thing, built for you |
19 |
automagically. Used within an app you must construct the pipe in code. An |
20 |
example would be reading a text file and inserting the line into a database. |
21 |
On the command line you would do |
22 |
|
23 |
tail -f /path/to/data/file | /path/to/insert/script |
24 |
|
25 |
A socket does the same thing in the style of networking as opposed to a raw |
26 |
pipe. All your local X clients do this, the X server created a socket and the |
27 |
clients plug into it. This is good because X is a networked gui system so you |
28 |
just do networking everywhere even if the server and client are on the same |
29 |
box. |
30 |
|
31 |
You use dbus if any old app needs to get an idea across to any other old app |
32 |
and you don't know who is doing what. You are always aware of what is at the |
33 |
end of a pipe (you built the thing) but if your jabber client wants a |
34 |
notification to be sent of an incoming message, it doesn't know or care how |
35 |
this is done - that is up to the notification apps. This is analogous to |
36 |
posting to a mailing list and asking anyone who knows the answer to a question |
37 |
to please speak up. |
38 |
|
39 |
A signal is a specific message you send to a specific process via the kernel. |
40 |
Send signal 15 to a process's PID and the kernel will relay it. The message |
41 |
will be interpreted as "shut yourself down now". |
42 |
|
43 |
-- |
44 |
alan dot mckinnon at gmail dot com |