Ordering message in kdbus
Kay Sievers
kay at vrfy.org
Mon Mar 31 14:41:42 PDT 2014
On Mon, Mar 31, 2014 at 5:37 PM, Greg KH <gregkh at linuxfoundation.org> wrote:
> On Mon, Mar 31, 2014 at 04:00:58PM +0200, Zzz Rrr wrote:
>> Hello,
>>
>> (I have already asked a similar question on DBus in an other thread.
>>
>> Here, I'm looking for similar information in the first part and then
>> additionnal information relative to kdbus functionnalities)
>>
>> 1 - Firstly, I would like to know how incoming messages are processed by
>> kdbus.
>>
>> I would like to confirm whether kdbus daemon handles messages in the same order
>> as it receives or if kdbus handles these messages in out of order way.
Kdbus is not a daemon, it is not even a kernel thread. There are no
active parts involved besides the sender and receiver process, it is
direct access one-to-one communication.
>> Take an example, we have 3 processes A, B, and C. A sends messages A1, A2, A3
>> (in this order), B sends B1, B2 (in this order) and C sends C1.
>>
>> We know there are several possibilities concerning incomming messages order.
>> Consider that kdbus receives messages in this order : A1,A2,B1,A3,C1,B2.
>>
>> In your opinion, what is the order that kdbus handles messages ? Is it
>> A1,A2,B1,A3,C1,B2 ?
>
> kdbus handles the messages in the order it receives them. If two
> processes are sending at the same time, it just happens to be how ever
> the locking works out (in other words, you better not be relying on
> multiple processes on multiple cpus to be sending in any specific order
> other than the order the processes themselves are sending them in.)
Right, there is one message queue per receiver; senders put their
messages directly into that queue, the access is serialized by locks.
The receiver reads the messages in the queued order. The order
different senders get access to a receiver's queue in not defined and
cannot be predicted or controlled.
Kay
More information about the dbus
mailing list