Terminate and Stay Resident

Terminate and Stay Resident (TSR) computer programs were the only way to achieve a primitive sort of multitasking (usually just task-switching) using the DOS operating system. Some TSRs were effectively device drivers for hardware not directly supported by MS-DOS, whilst others were small utility programs offering frequently-used functionality such as scheduling and contact directories.

Normally, in the MS-DOS operating system, only one program could be running at any given time, and when it wanted to stop running, it relinquished the control to MS-DOS's shell program, command.com, using the system call INT 21H/4CH. The memory and system resources used by the program were marked as unused, effectively making it impossible to summon parts of it again. However, if a program ended with the system call INT 21H/31H, the operating system did not reuse a certain, specified, part of the program's memory.

The call, introduced in MS-DOS version 2, was called 'Terminate and Stay Resident', hence the name 'TSR'. Before making this call, the program could install one or several interrupt vectors pointing into itself, so that it would be called again. Installing a hardware interrupt vector allowed such a program to react to hardware events; a software interrupt vector allowed it to be called by the currently running program; using a timer interrupt allowed a TSR to be summoned periodically.

A TSR could be loaded at any time; sometimes, they were loaded immediately after the operating system's boot, by being explicitly loaded in either the AUTOEXEC.BAT or CONFIG.SYS scripts, or alternatively at the user's request (for example, Borland's SideKick and Turbo Debugger). These programs would, as the name implied, stay resident in memory whilst other programs were executing. Most of them didn't have an option for unloading themselves from memory, so loading a TSR meant it would stay until a reboot. However unloading was possible externally, using utilities like the MARK.EXE/RELEASE.EXE combo by TurboPower Software or soft reboot TSRs which would catch a specific key combination and release all TSRs loaded after them.

Whilst very useful, or even essential to overcome MS-DOS's limitations, TSRs had a reputation as troublemakers. The programs effectively hijacked the operating system in varying, undocumented ways, often causing systems to crash on their activation or deactivation when used with particular application programs or other TSRs. Some viruses were coded as TSRs, and were deliberately troublesome. Additionally, all program code in MS-DOS systems, even those with large amounts of physical RAM, had to be loaded into the first 640KB of RAM. TSRs were no exception, and took chunks from that 640KB that was thus unavailable to application programs. This meant that writing a TSR was a challenge of achieving the smallest possible size for it, and checking it for compatibility with a lot of software products from different vendors—often a very frustrating task.

In the late 1980s and early 1990s, many video games on the PC platform pushed up against this limit and left less and less space for TSRs—even essential ones like CD-ROM drivers—and arranging things so that there was enough free RAM to run the games, while keeping the necessary TSRs present, became a black art. Many gamers had several boot disks with different configurations for different games.

With the arrival of expanded memory boards and especially of Intel 80386 processors in the second half of the 1980s, it became possible to use memory above 640KB to load TSRs. This required complex software solutions, named Expanded Memory Managers, but provided some additional breathing room for several years. Famous memory managers were QRAM and QEMM by Quarterdeck, 386Max by Qualitas, CEMM by Compaq and later EMM386 by Microsoft. The memory areas usable for loading TSRs above 640KB have been called upper memory blocks (UMBs) and loading programs into them was called loading high. Later, memory managers started including programs which could automatically determine how to best allocate TSRs between low and high memory (Quarterdeck's Optimize or Microsoft's MemMaker) in order to maximize the available space in the first 640KB.

With the development of games using DOS extenders (a notable early example was Wolfenstein 3D) which bypassed the 640KB barrier, many of the issues relating to TSRs disappeared, and with the widespread adoption of Microsoft Windows and especially Windows 95 - which rendered TSRs both unnecessary and incompatible - the TSR faded into the background. The TSR has now disappeared completely, as multitasking operating systems such as Windows XP, Mac OS, and Linux provide the facilities for multiple programs to run simultaneously without the need for special programming tricks.es:TSR ru:Резидентная программа

Navigation

  • Art and Cultures
    • Art (https://academickids.com/encyclopedia/index.php/Art)
    • Architecture (https://academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (https://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (https://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools