Thomas De Schampheleire wrote:
Hi,
I need some kernel code to be executed periodically and I am wondering
what the best way would be to achieve this.
I can imagine the following possibilities:
- Have a thread run containing a while loop with a delay inside. This
would have the disadvantage that the time between the thread's
execution is run is not always fixed (it would depend on the load of
the system, ...).
Bad idea. It also is incompatible with Dynamic Reconfiguration.
- Schedule a task to run at certain times. How do I achieve this?
Which functions can I use from within the kernel to use the timer?
Yes. You can use timeout(9f) to start code that runs briefly (same
restrictions as for interrupt handlers, although I think the registered
function actually runs on a more or less "normal" kernel thread.
You can also use taskq(9f) functions to run code, especially if you need
to do things like cv_wait. To make a taskq run periodically you can use
ddi_taskq_dispatch(9f) from inside a timeout(9f) handler.
- Are there any other possibilities? Do they have certain
advantages/disadvantages?
There are others. But the aforementioned ones are the only ones that
are DDI compliant, and also guaranteed not to interfere with Dynamic
Reconfiguration/Suspend-Resume.
-- Garrett
Thank you,
Thomas De Schampheleire
------------------------------------------------------------------------
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code