Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6502

Can two Linux kernel timer handlers get executed at the same time?

$
0
0

I am writing a kernel module with timers as below,

timer1_callback(){    // task of timer1}timer0_callback(){    while(1){        // Do some input processing        if (condition){            Update timer1 to fire in 15 seconds from now        }    }}module_init(){    //Initialize timer0 to fire in 1 second.    timer_setup(&timerl0, timer0_callback, 0);    mod_timer(&timerl0, jiffies + msecs_to_jiffies(1000));    //Initialize timer1 to fire in 15 seconds.     timer_setup(&timerl1, timer1_callback, 0);    mod_timer(&timerl1, jiffies + msecs_to_jiffies(15000));}

I have initialized the timers as above. In this setup, timer0 will be in an infinite loop, waiting for some inputs (from the input event subsystem). According to that input, if a condition is met, timer1 will be updated to fire in 15s from that point onwards.

When I executed the above system, timer1_callback did not get executed at all. Even when the condition is met, it did not fire after 15s.

Are the separate timers get executed in separate threads or in a single thread?Why the second timer never got triggered?


Viewing all articles
Browse latest Browse all 6502

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>