TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: SYLVAIN LAUZON
from: DENIS BOYLES
date: 1997-03-21 17:15:00
subject: Interrupts

RE: How do TSR programs and interrupts work?
SL>But when the hot-key is pressed and pass the command to the program
SL>How does other resident programs continue been executed in background?
I guess, technically they don't, since DOS is a single tasked OS, it doesn't
multitask. So, really only one program is running at a given time, it's
just an `illusion' that multiple programs are running.
The key word is interrupt, because that's exactly what the system does when
an interrupt occurs. It stops executing the current program wherever that
may be, and then executues the new one. Thus the current program is
interrupted by whatever, like a keypress or mouse click.
In the example of a keypress, each program hooked in the keyboard
interrupt is chained to the next one. The first program checks for it's
hotkey, if it's not there, then it chains to the next program and so on.
 --------
|KEYPRESS|  <--START OVER AGAIN WAITING FOR KEYPRESS------\
 --------                                                 |
    |                                                     |
 ---------------------              ------------          |
|(1) programs hot-key?|------>|ACTIVATE TSR|---->----/
 ---------------------              ------------          ^
    |                                                     |
 ---------------------              ------------          |
|(2) programs hot-key?|------>|ACTIVATE TSR|---->----/
 ---------------------              ------------          |
    |                                                     ^
 ---------------------              ------------          |
|(3) programs hot-key?|------>|ACTIVATE TSR|---->----/
 ---------------------              ------------          |
    |                                                     |
  ----                                                    |
 |IRET|----->----->----->----->----->----->----->---------/
  ----
Hopefully this diagram gives you an idea of what I'm talking about. Here
there are three TSR programs that have hooked the keyboard interrupt. When
a key is pressed, the running program is interrupted and the hot-keys
checked. If TSR 1's hot-key was found, then that TSR becomes active and when
finished returns to the interrupted program. If the key wasn't found, then it
chains to the next TSR, and so on.
Notice that things are being interrupted, and that not all three TSR programs
are being run at the same time. Even if you hooked the timer interrupt things
are being interrrupted. Normally the timer interrupt is called 18.2/second
by the clock. This isn't multitasking, but rather a process of stopping and
starting programs 18.2 times a second. Because the time is really fast to us,
it appears the computer is doing several things all at once.
Cheers,
  Denis Boyles

 * OLX 2.1 TD * hAS ANYONE SEEN MY cAPSLOCK KEY?
--- Maximus/2 3.01
---------------
* Origin: Frog Hollow Port Moody BC 604-469-0264/0284 (1:153/290)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.