Hi, thanks Matias

The example is very helpful, one question follow it:

Previously I understand atomic queue like multiple producer/single consumer
behaviour, so producers (enqueue threads) can still run in parallel?

But in the example the two producer threads behaves like sequentially while
enqueueing atomic queue?

A1, A2 (new allocated), A0 (original), B1, B2 (new allocated), B0 (original)

Best Regards, Yi

On 28 November 2016 at 20:40, Elo, Matias (Nokia - FI/Espoo) <
matias....@nokia-bell-labs.com> wrote:

>
> On 28 Nov 2016, at 12:19, Yi He <yi...@linaro.org> wrote:
>
> Thanks Matias
>
> Very clearly documented:
> “
>  * Event ordering is based on the
>  * received event(s), but also other (newly allocated or stored) events are
>  * ordered when enqueued within the same ordered context.
> “
> One question is that for scheduled events, their order are very clear
> determined by their original sequence in the receiving queue, but what's
> the relationship and sequence between new allocated events with the
> received ones, especially if the allocation happens in multiple threads.
>
>
>
> The events enqueued within the same ordered context should be received in
> the same order as they were enqueued = FIFO (i.e. if the newly allocated
> events where enqueued before the original event, the new events will  be
> received first). The order holds for the whole ordered context.
>
> For example:
>
> Two threads (A & B) schedule work from the same ordered queue and enqueue
> processed events to a common atomic queue . Both threads call
> odp_schedule() and receive a single event -> A gets ordered context 1 and B
> gets 2. While processing the event, thread A allocates two new events
> (A1&A2). Finally, it enqueues them to the atomic queue in the following
> order: A1, A2, A0 (original event). Thread B does the same thing (B1, B2,
> B0).
>
> As the atomic context holds for the whole context the events are received
> in the atomic queue in the following order: A1, A2,  A0, B1, B2, B0,
> independent of which of threads performs the enqueue operations first.
>
> -Matias
>
>

Reply via email to