Writing device drivers

Russ Steffen (rsteffen@ia.net)
Sat, 17 Feb 1996 23:30:22 -0600 (CST)


Hello,

I was working on writing a small device driver to get the feel of how
it works, and I've come up with a few questions.

1) Is there any way to limit the amount of CPU used by a device driver?

The driver I was hacking on was a stupid little "hello world" type
thing, all it did was output a string on read(), and had an ioctl
to set the string. It's pretty simple, and works fine, but 'cat'ing
chews up 99% of the CPU while it runs. Presumably this is because
scheduling can't occur while my driver code runs, so it has to happen
while 'cat's code is running. Since 'cat' is a tight loop of read()'s
and write()'s, the 'window' for process scheduling is very small, so
'cat' ends up stealing the CPU.

So, is there anything that can be done to let a schedule happen in
my driver to balance the CPU load some?

2) I'm working with 1.3.66, and I noticed that there are a bunch
of string manipulation routines in the kernel's lib, but they aren't
exported to modules. Is there a reason for this, or just an oversight?

BTW, I tried just adding them to ksyms.c, but that didn't work. The
kernel link failed with those symbols unknown.

I'm beginning to think we need to work on a standard (and documented!)
module API. Perhaps a goal for the next development series. I wouldn't
mind documenting it, if need be.

Thanks,
Russ

-- 
+-------------------------------------------------------+
| Russ Steffen                                          |
| EMail: rsteffen@ia.net                                |
+-------------------------------------------------------+