Timer queues: Which one should I use...

NIIBE Yutaka (gniibe@mri.co.jp)
Wed, 7 May 1997 08:44:47 +0900


Hi, thanks for your effort to support Zip drive,

campbell@tirian.che.curtin.edu.au writes:
> I've only just joined this mailing list but I've heard that there has
> been some discussion on timer queues. I have been working on a driver
> (Iomega parallel port ZIP drive) and found that tq_scheduler stops
> polling/processing when the system loads up (gcc -O2 does it quiet
> nicely when compiling the gcc source).
>
> I've since switched to using tq_timer with more stable results but
> apparently there has been a performance drop. Any suggestions?

While the tasks of tq_timer are executed by timer ticks, tq_immediate
runs (somewhat) immediately. You can queue some tasks on the queue of
tq_immediate, and the tasks are executed when bottom_half is called.
For example, you can queue a task in the interrupt handler, and the
task is executed when the control exits interrupt handler and
bottom_half is called. Another example is, you can queue a task in
normal kernel mode (not interrupt), and when the control goes back to
userland, bottom_half is called and the task is executed.

Usage:
queue_task(&task, &tq_immediate);
mark_bh(IMMEDIATE_BH);

Although I don't know much about ZIP drive, here is a idea:
For slow command (seek/write/...): use tq_timer
For fast command (read/status/..): use tq_immediate

Hope this helps,

-- 
NIIBE Yutaka