Timer Issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

after reading chapter 6 of the Linux Device Driver Book 2nd Edition, I
still do not know the best way to achieve a timed execution of kernel
code.  For this reason, I contact this list to hope for a good hint.

The Problem:

In kernel space, I run some byte counter of which the code is loaded
as a module.  This works perfectly.

I would like to have a function that gets triggered every second
to read the actual state of the counters, this function is called
timed_func() later.   The function should be triggered irrespective of
the status of the other functionality /* I know about the race conditions... 
and the fact that the linux kernel is not interruptible per node */

Ideas:

In my mind the following ideas on came up how this problem could be
solved in principle:
a) implement timed_func() as a "normal" function in the same module --
   this would be the easiest.
b) implement timed_func() as a separate module-function.  There, I
   assume there is no difference executionwise.
c) implement timed_func() as an own kernel_thread such that it gets a
   schedulable entity.

My Questions:
- Is it possible to have timed_func() being launched every second in
  cases a) & b) or is the whole kernel module blocked until the
  function gets executed?
  
  If it would be possible to implement a) or b), how could I achieve
  this? 
- Is there another solution/idea that has not come to my mind so far?


Thanks in advance for any hint!
 
wbr,
Lukas
-- 
Lukas Ruf           | Wanna know anything about raw |
<http://www.lpr.ch> | IP?  <http://www.rawip.org>   |
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux