Re: NT DDK vs. Linux DDI, a practical comparison [long]

Gordon Chaffee (chaffee@cs.berkeley.edu)
Sun, 20 Sep 1998 03:05:45 -0700 (PDT)


Stephen Williams writes:
> There is no "printk" under NT. There is the event logger, which is fine as
> far as it goes, but after a while you start having nightmares in UNICODE;
> so I wrote a printk replacement whose outputs can be read from a virtual
> device, and this is my best debugging tool. It turns out that there is
> a tool to display DbgPrint messages, but that function is compiled out
> in the "free" (meaning optimized) build.

I'm confused by this. DbgPrint works fine in non-checked build.
I was under the impression that OSR's utility for displaying mesages
that are printed with DbgPrint or using OutputDebugString (user space)
without a debugger attached worked fine on non-checked builds.
You can definitely view the messages it prints over a serial line
connection to another computer. I'm not suggesting that DbgPrint
is better. When I wrote a MPEG decoder driver for Linux and NT,
it was a hell of a lot easier finding problems in Linux. I just
had a million prinks flying off the screen, and when the system would
lock, I could see what it was doing. This barely slowed down Linux.
With NT, it had to go across a slow serial line, so you could forget
about trying to track down occasional locks that way. I was seeing
lockups once every few hours of decoding. I'm sure some people never
resort to this sort of debugging technique, but I found it worked
wonders. Just make sure your syslogd and klogd are disabled.

> NT completely lacks anything like mmap support. Video devices have a
> different interface that doesn't seem to intersect with the
> read/write interface that I also require, so heck. I found a
> roundabout way to do it--it's scary, but it works. It is not a
> general solution. This is surprising, because you can mmap files
> under NT. It turns out that file mapping is implemented by the file
> system and never gets down to the driver.

Unless I misunderstand something, it does. I have source code for
a skeleton NT PCI driver that I wrote a few years ago at
http://bmrc.berkeley.edu/people/chaffee/winntutil.html
I have a routine in the driver called MapMemory that takes physical
memory on the PCI bus and maps it into a user mode process's address
space. Maybe this isn't what you are talking.

> NT has no module autoloader. Or unloader. You can explicitly load a driver,
> or unload it, but nothing will figure it out for you. It most certainly
> can *not* handle modules (*.sys files) referencing other modules. Linux
> is light-years ahead here.

Not quite true. You can create modules that reference other modules.
You just have to be very careful. If you are interested in doing this,
I can look up some old code that did it. One thing I noticed is that
it might never unload module1 if module2 depends on it even though
module2 might be unloaded.

I'll take Linux kernel development over NT any day although I really
wish the i386 kernel debugger over a serial line was integrated into
Linux. I know, there are patches, but why don't we have the option
of using the debugger like the folks on SparcLinux, etc do by default?
Even FreeBSD has this capability. Yeah, I know, use the source Luke.
I use a debugger for developing in user space not to avoid becoming
one with the code but because I find it easier to track down bugs.
Sometimes a debugger gets in the way because you use it as a crutch
when you shouldn't be, but other times, it just makes tracking the
errors down easier.

- Gordon

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/