order of execution

At my university I am working on one project that involves some kernel programming. One part of this is loadable kernel module that registers interrupt handler for some given interrupt.

Now I have shared data structure that is used by interrupt handler and tasklets and I am wondering if I can be sure that tasklets are executed in the same order that they are scheduled or is it undefined?

For example my interrupt handler is called at time t1 and time t2 , each invocation executes tasklet_schedule(&customTasklet); . Now, can I be sure that the tasklet that was scheduled at time t1 will be executed first?


Scheduled tasklet are stored within a list; the system read this list in FIFO order, so: yes t1 is executed before t2 .

Here some code to understand the mechanism.

edit

As reminded by CL, there is a tasklet list for each CPU; so when you shedule a tasklet, you are scheduling it on the active CPU. So tasklet are serialized on the same CPU. If you schedule t1 un CPU1 and t2 on CPU2 it may happen that t2 is executed before t1 .

链接地址: http://www.djcxy.com/p/84794.html

上一篇: Tasklets下半部分计划

下一篇: 执行顺序