The New Generation Of Banging Hardtechno Forum Index The New Generation Of Banging Hardtechno
The New Generation Of Banging Hardtechno
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   GalleriesGalleries   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

planet.freedesktop.org

 
Post new topic   Reply to topic    The New Generation Of Banging Hardtechno Forum Index -> Kill Brothers
View previous topic :: View next topic  
Author Message
jianyopu
wow im here



Joined: 12 Jan 2011
Posts: 10
Read: 0 topics

Warns: 0/5
Location: England

PostPosted: Sat 20:04, 19 Feb 2011    Post subject: planet.freedesktop.org

Multicast on seqpacket sockets
Have infinite sized receiving queues. This is not really an option, is it?
Drop messages, either silently or with a notification to the recipient (”you have lost some messages”). This is the correct semantic for udev. Netlink sockets notifies recipients about lost messages with ENOBUFS in recvmsg(2).
Block the sender. The sender will block or send() will return EAGAIN with non-blocking sockets. Poll() or select() will tell when a message can be delivered again.
Disconnect the slow recipient
Disconnect the spammy sender
The daemon controlling the multicast group can receive the messages from the peers if the feature “send-to-peer” is enabled.
Each socket can upload a socket filter (or Berkeley Packet Filter, BPF) in the kernel. Socket filters are small programs, executed for every message sent to a socket. If the socket filter returns zero, the message is discarded and the process does not need to wake up.
Flow control
Seqpacket sockets are connection-based and the daemon can control who is able to join the group. The daemon can receive the messages from the peers on its accepted sockets (A1, A2, A3 on the diagram above) with the “send-to-peer” feature. It is useful for D-Bus: dbus-daemon can reply to the method calls on the bus driver.
Multicast on datagram sockets
The setsockopt() call which creates the multicast group binds the socket on the multicast address. Messages sent to the group are received by all members, including the sender, if it joined with the “loopback” feature. Socket filtering may be used by a recipient to avoid receiving messages, however this does not affect delivery of the message to other peers in the group.
The correct solution for D-Bus is not trivial. This is not a new problem: even without multicast Unix sockets, dbus-daemon already has the same problem. Discussion in bug #33606. The current implementation of multicast Unix sockets either drops messages silently or blocks the sender, depending on the setting of the multicast group.
Atomic delivery
A and B are sending one message concurrently to recipients C and D. Without proper locking, the recipients could receive the messages A and B in a different order. My patches take care of this and the test suite checks that messages are received in the same order by all recipients.
My implementation aims to be a general purpose multicast IPC system, without the limitations of netlink multicast. The kernel patches and a test suite are available in git:
Several projects could benefit from this new IPC system:
Socket filters may be applied on SOCK_DGRAM and SOCK_SEQPACKET only. They make little sense on SOCK_STREAM because there are no message boundaries. This limits the size of D-Bus messages to about 110kB, although it can be changed with setsockopt(SO_SNDBUF) up to a maximum of 219kB (or more by tuning /proc/sys/net/core/rmem_max).
I have been working on implementing multicast Unix sockets in the Linux kernel. This allows a process to send a message on a socket to a multicast group with one system call sendmsg() and the message will be received by all sockets member of the multicast group.
Ordering
The socket filter could be modified and uploaded in the kernel every time the D-Bus peer wants to add or remove a D-Bus match rule and get or lose a unique or well-known name. So D-Bus messages are not delivered to every D-Bus peer but only the right recipients.
D-Bus
D-Bus is a message bus system. Applications exchange D-Bus messages traditionally through a central process, dbus-daemon. When dbus-daemon receives the message,[link widoczny dla zalogowanych], it determines the recipients and delivers the message to each recipient’s socket. This architecture causes dbus-daemon to wake up for every single message causing expensive context switches,[link widoczny dla zalogowanych], memory copies and processing. If the D-Bus peers were part of a multicast group, the kernel could deliver D-Bus messages directly to the recipients. It could use socket filters to deliver them only to the correct recipients, according to the D-Bus match rules.
The T IPC system
In the same manner as D-Bus, multicast Unix sockets and socket filters could be used by the T IPC system.
Udev
Udev uses Linux’ netlink sockets to send multicast messages from udevd to libudev listeners. Netlink sockets are usually used for communication between the kernel and userspace, but can also be used for userspace-only communication. It has limitations though; there are only 32 multicast groups, system-wide,[link widoczny dla zalogowanych], and only root can send multicast messages.
Update: netlink does not have that limit anymore since 2005.
git clone [link widoczny dla zalogowanych] unix-multicast18
git clone [link widoczny dla zalogowanych]
Multicast is implemented on datagram and seqpacket sockets, but not on stream sockets. It would not make sense on stream sockets because the messages are not delimited and there would be no guarantee that several senders’ messages would not be mixed. The semantics are different between datagram and seqpacket sockets.
 
When several senders are sending messages concurrently, the recipients need to receive messages in the same order. Here is a scenario I want to avoid:
Socket filter for D-Bus
When a reader is too slow to consume messages from its receiving queue, the receiving queue could be full. There is several ways to manage this situation:
Messages are delivered atomically to all recipients. This is true even when the sender is interrupted by a signal, killed, lacks memory or is blocked because of the flow control. I don’t want a message to be partially delivered to some recipients. When the system call sendmsg() returns an error (such as EAGAIN), it is guaranteed that nobody received the message.
This work has been sponsored by my employer Collabora.
相关的主题文章:


[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]


The post has been approved 0 times
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    The New Generation Of Banging Hardtechno Forum Index -> Kill Brothers All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
Regulamin