It's pure draft, vapourware, nothing to see here etc. Only interesting if you're into that sort of technical discussion (but doesn't fit any other forum afaict.)
Code: Select all
# public-domain (by notadev & igli, if it matters where you live.)
# - all copyright is disclaimed, where applicable.
# if you can implement it, we'll sure as hell use it ;-)Code: Select all
IPC:
PID_a | kernel | PID_b
| PERM |
[proto] | FTAB | [proto]
[send] [fd] pipe =>[fd] [recv]
| TX msgq RX |
| sockbuf |The important thing here is that the processes don't (necessarily) know each other, and address-space isolation is critical.
Since we have no idea where the data is coming from (in terms of alignment), nor where it's going to end up (because userland supplies the buffer write addresses), there is no real choice but to copy from process to process.
We've discussed mapped-msgq's (a standard implementation technique) using a slightly different API, to avoid any copying, which is still something we'd like to pursue. But let's crack on with prior-craft.
A pipe is the most basic of the above; you should be familiar with them from shell (or if not, /autojoin #bash for a few months, to get up to speed with userland.)
It's important to realise that if we're programming "Communicating Sequential Processes", we're likely to start with pipes, and then use shared memory, before we go onto anything else. The other IPC mechanisms are more likely to come into play when we want to provide an abstraction to other, unknown processes. From what I've seen, this one gets overlooked as a mechanism:
Code: Select all
CSP:
PID_M | kernel | PID_N
[open,map] | PERM PERM | [open,map]
<-SYNC-> " [shmem] " <-SYNC->
| @/R/W? @/R/W? |Again, processes don't need to know each other, though if not they're likely using the same lib-code.
A named shared-memory area is not tied to anyone process; in fact it will stay around until the system reboots (or it is reinitialised) as will other named POSIX IPC mechanisms.
Another thing to bear in mind, is that often we just want event notifications, along with a number or pointer of interest, for which normal IPC mechanisms are a bit heavy. For this, POSIX realtime-signals (with reliable ordering and count) are a perfect match:
Code: Select all
events:
PID_a | kernel | PID_b
| PERM |
| PTAB | sigaction
[sigqueue] [pid] int, info* [pid]
| TX RX |
| |Code: Select all
XORG: (afair; notadev.)
PID_a | kernel/NET | X X | kernel/NET | PID_N
| PERM | | PERM |
[Xproto] | FTAB | sigaction [Xproto] [Xproto] | FTAB | [Xproto]
[send] [fd] -> sockbuf =>[fd] allow? [recv] MUX <| [send] [fd] sockbuf =>[fd] [recv]
| TX UCRED RX | SIGIO queue | TX RX |
| | | |If we take a look at dbust, a mechanism pushed in order to implement a policy of GPL-evasion, we see why it's all kinds of bottleneck:
Code: Select all
DBUS: cf: https://bugs.freedesktop.org/show_bug.cgi?id=33606#c9
PID_a | kernel | DBUS DBUS | kernel | PID_N
[glib] | PERM | | PERM | [glib]
[dbus] | FTAB | epoll in [POLICKY] out | FTAB | [dbus]
[send] [fd] -> sockbuf =>[fd] [recv] queue MUX <| queue [send] [fd] -> sockbuf =>[fd] [recv]
| TX UCRED RX | | TX RX |
| | | |The bigger problem of what it's being used for on the local machine, is not addressed by looking at what it does, though as we've seen it was already a busted flush from day one.
More worrying is the recent Damascene-conversion to a POSIX API, rt-signals, worrying because there is an associated land-grab of all RT-signals on a machine from init; as if they've found someone else's ball, it's shinier than theirs, and now are claiming that it is theirs.
This seriously degrades the capability of any machine using such an insanely-designed init-process.
Let's look at a well-designed protocol, specifically for the local-machine/cluster situation.
This is what [post=7659734]kdbust[/post] is trying to be, but failing miserably: because it tries to reinvent dbus, which tries to reinvent the kernel under RedHat's control.
TIPC is a much saner project, and all it needs is CONFIG_TIPC in your kernel config (you might want to up CONFIG_TIPC_PORTS to 16384 or more):
Code: Select all
TIPC: cf: http://www.spinics.net/lists/netdev/msg190623.html
PID_a | node/CLUSTER kernel node/CLUSTER | PID_N
| PERM |
[proto] | RX TIPC TX FTAB | [proto]
[send] [fd] -> [port]<= sockbuf MUX <| [port] |> sockbuf =>[fd] [recv]
| TX RX |
| |
# -- seems like an ideal fit for local X (including SO/HO LAN.)Code: Select all
UMUX: [capnproto: enc/dec]
DEVICE | kernel node UMUX <=ctl=> | edev: config
| NET -> rt-netlink -> dhcpcd | e(disk|power)
| DRIVER [NET: mactab] | AUDIO -> " -> ejack-ctl [sigqueue] FTAB | [capndec]
[IRQ] [port]<= bhalf NOTIFICATION CHAIN | BPF | UMUX [capnenc] TIPC <| [port] |> sockbuf =>[efd] [recv]
| TX ... handle? Y MUX RX | ejack-data
| N: drop | PID_NAndy Lutomirski recommended capnproto on the lkml (sorry, don't recall url; came up in other thread/s) and it rocks, so let's use it.
Secondly we need a pub/sub channel for userland to react to kernel events, after they've been handled above, and userland to talk to each other. So [post=7660416]let's use TIPC[/post] as it's much better than anything else, and we both feel nothing else is going to be any better, or it'll end up being effectively the same thing:
Code: Select all
UBUS: cgroups: delete-on-empty and: delete-and-notify
UDP socket for control events; UCRED required to connect [config: port, daemon per namespace; eg: ejack]
standard TIPC for events (UMUX: recv as above)
ORB: [capnproto: RPC]
PID_a | node kernel node | PID_N
| PERM |
[capnproto] | TIPC FTAB | [capnproto]
[send] [fd] -> [port]<= sockbuf MUX <| [port] |> sockbuf =>[fd] [recv]
| TX RX |
| |If you want to learn how to code with the standard userbase, see the books link from /topic ##posix. If you don't have a copy of Gallmeister, you won't get far.
Note: PERM means the kernel permission-check, which is going to happen in any case.
edits: explanation, links, sperling ;) Lutomirski not Mitorski.
"ubus" is taken; the project is very relevant though.



