Question on serialization of KMDF work items

I am creating work items using WdfWorkItemCreate and queueing them to a random kernel thread using WdfWorkItemEnqueue.

So I have function foo() where I do the above, first create and then queue.

If I call foo() 2 times from 2 different threads or even the same thread (let us say user thread executing an ioctl which then executes foo()), is there an implied ordering in how the work items are executed?

So if I queue WI #1 followed by WI #2, is it guaranteed that WI #1 will execute before WI #2?. Both work items have the same parent ParentObject (KMDF object).

Thanks,
RK

There is no ordering guarantees in this scenario. The usual answer is that the ordering of when the work items run doesn’t matter, the producer outs work into the queue and the worker(s) pop the next item out of the queue in order.

1 Like

Doron, thank you. This is what I thought but I needed someone more knowledgeable than me to confirm/deny it. Thanks