David M. Wilson said:
In popular speak, the term 'TSR' does indeed usually refer to the type
of program that hooked itself into DOS and returned control to the
operating system. I'm scared if Apache is implemented as a TSR, it
should really be using cleaner interfaces than that...
..if you refer to Apache as a TSR, then I suggest you change your
vocabulary. 'TSR's under *nix are more often known as background
processes, or more specifically in Apache's case, a daemon.
They're the same thing. Sure TSR really arose out of MSDOS but let's
not forget it means "Terminate and Stay Resident". Which is a bit of
a misnomer but really is a daemon. Many TSRs were device drivers
[e.g. network shares, mouse, keyboard, etc].
[f-ups set to comp.programming]
Now, this is way OT for c.l.c, and I think Mark Odell basically
corrected Tom elsethread, but I would like to make sure *my*
understanding is basically correct here (having done quite a bit
of TSR programming, and knowing a bit about *nix processes).
An MS-DOS program can invoke a DOS service to "terminate and
stay resident," at which point the control flow returns to the
OS but the program's code remains in memory. TSRs were often
used to hook into the system's interrupts in order to do clever
things in response to events (keypresses, timer alarms, etc).
A Unix or Linux program just runs. Each program (process)
gets its own instruction pointer. The program can't "terminate
and stay resident," although it *can* suspend its IP for a
while. But the IP never leaves the program's "space" until
the program actually terminates and its code is discarded out
of RAM.
*nix processes can suspend themselves, or be suspended, *or*
the shell can let them "run in background." "Background" is
a shell-level concept completely foreign to the kernel.
Daemons are programs that usually run in the background.
They look similar to TSRs, because they only interact with the
user upon receiving certain external signals ("signals" in the
general sense, not the Unix sense). But unlike TSRs, they can
act whenever they feel like it, because they have their own
instruction pointers that are still executing code, even when
the user can't see their effects.
When Tom St Denis talks about Apache, he's talking about a
web server daemon of some sort. It's certainly not a TSR,
because it never T's.
Have I got it right?
-Arthur