Conventional memory
Encyclopedia
In DOS memory management
, conventional memory, also called base memory, is the first 640 kilobyte
s of the memory on IBM PC
or compatible systems. It is the read-write memory usable by the operating system and application programs. As memory prices rapidly declined, this design decision became a limitation in the use of large memory capacities until the introduction of operating systems and processors that made it irrelevant.
PCs. The Intel 8088
CPU, used in the original IBM PC, was able to address 1 MB (220 bytes), as the chip offered 20 address lines.
In the design of the PC, the memory below 640 KB was for random-access memory
on the motherboard or on expansion boards. The 384 KB above was reserved for system use and optional devices. This upper portion of the 8088 address space was used for the ROM BIOS, additional read-only memory, BIOS extensions for fixed disk drives and video adapters, video adapter memory, and other memory-mapped input and output devices
.
The design of the original IBM PC placed the Color Graphics Adapter
(CGA) memory map and other hardware in the 384 KB upper memory area
(UMA). The need for more RAM grew faster than the needs of hardware to utilize the reserved addresses, which resulted in RAM eventually being mapped into these unused upper areas to utilize all available addressable space. This introduced a reserved "hole" (or several holes) into the set of addresses occupied by hardware that could be used for arbitrary data. Avoiding such a hole was difficult and ugly and not supported by MS-DOS
or most programs that could run on it. Later, space between the holes would be used as upper memory blocks (UMBs).
To maintain compatibility with older operating systems and applications, the 640 KB barrier remained part of the PC design even after the 8088 had been replaced with the Intel 286 processor, which could address up to 16 MB of memory. The 1 MB barrier also remained as long as the 286 was running in compatibility mode, as MS-DOS forced assumptions about how the segment and offset registers overlapped such that addresses with more than 20 bits were unsupported. It is still present in IBM PC compatibles today if they are running MS-DOS, and even in the most modern Windows-based PCs the RAM still has a "hole" in the area between 640 and 1024 KB
s, which however is invisible to application programs thanks to paging
and virtual memory
.
A similar 3 GB barrier
exists, which reduces 32-bit addressing from 4 GB to 3 GB on motherboards that use memory mapped I/O. However, due to applications not assuming that the 3–4 GB range is reserved, there is no need to retain this addressing for compatibility, and thus the barrier is easily removed by using a separate address bus for hardware, and only affects a relatively small number of computers.
(MDA). Sometimes software or a custom address decoder
was used so that attempts to use the video card memory went instead to the standard memory. This moved the barrier to 704 KB.
Memory manager
s on 386-based
systems (such as QEMM
or MemoryMax in DR-DOS
) could achieve the same effect, adding conventional memory at 640 KB and moving the barrier to 704 KB or 736 KB (the start of the CGA). Only CGA could be used in this situation, because Enhanced Graphics Adapter
(EGA) video memory was immediately adjacent to the conventional memory area below the 640 kB line; the same memory area could not be used both for the frame buffer of the video card and for transient programs.
The AllCard, an add-on memory management unit
for XT-class computers, allowed normal memory to be mapped into the A0000-EFFFF (hex
) address range, giving up to 952 KB for DOS programs. Programs such as Lotus 1-2-3
, which accessed video memory directly, needed to be patched to handle this memory layout. Therefore, the 640 KB barrier was removed at the cost of hardware compatibility.
It was also possible to use DOS's utility for console redirection, CTTY, to direct output to a dumb terminal or another computer running a terminal emulator. The video card could then be removed completely, and assuming the BIOS still permitted the machine to boot, the system could achieve a total memory of 960 KB of RAM. This also required that the system have at least 2 MB of physical memory in the machine. This procedure was tested on a 486 with IBM PC DOS 7.0. The total operating system footprint was around 20 KB, most of DOS residing in the high memory area (HMA).
(TSR) programs could be used in addition to the standard DOS software. These drivers and utilities typically permanently used some conventional memory, reducing the total available for standard DOS programs.
Some very common DOS drivers and TSRs using conventional memory included:
As can be seen above, many of these drivers and TSRs could be considered practically essential to the full-featured operation of the system. But in many cases a choice had to be made by the computer user, to decide whether to be able to run certain standard DOS programs or have all their favorite drivers and TSRs loaded. Loading the entire list shown above is likely either impractical or impossible, if the user also wants to run a standard DOS program as well.
In some cases drivers or TSRs would have to be unloaded from memory to run certain programs, and then reloaded after running the program. For drivers that could not be unloaded, later versions of DOS included a startup menu capability to allow the computer user to select various groups of drivers and TSRs to load before running certain high-memory-usage standard DOS programs.
(UMA) at boot, in order to maximize the conventional memory available for applications. This had the advantage of not requiring hardware changes, and preserved application compatibility.
This feature began with DR-DOS
5 and was later implemented in MS-DOS
5. Most users used the accompanying EMM386
driver provided in DOS 5, but third-party products from companies such as QEMM
, also proved popular.
At startup, drivers could be loaded high using the "DEVICEHIGH=" directive, while TSRs could be loaded high using the "LOADHIGH" or "LH" directive. If the operation failed, the driver or TSR would alternately automatically load into the regular conventional memory.
config.sys, loading ANSI.SYS into UMBs, no EMS support enabled:
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE NOEMS
DEVICEHIGH=C:\DOS\ANSI.SYS
autoexec.bat, loading MOUSE, DOSKEY, and SMARTDRV into UMBs if possible:
LH C:\DOS\MOUSE.EXE
LH C:\DOS\DOSKEY.EXE
LH C:\DOS\SMARTDRV.EXE
The ability of MS-DOS versions 5.0 and later to move their own system core code into the high memory area (HMA) through the DOS=HIGH command gave another boost to free memory.
An unusual aspect of drivers and TSRs, is that they would use different amounts of conventional and/or upper memory, based on the order they were loaded. This could be used to advantage if the programs were repeatedly loaded in different orders, and checking to see how much memory was free after each permutation. For example, if there was a 50k UMB and a 10k UMB, and programs needing 8k and 45k were loaded, the 8k might go into the 50k UMB, preventing the second from loading. Later versions of DOS allowed the use of a specific load address for a driver or TSR, to fit drivers/TSRs more tightly together.
In MS-DOS 6, Microsoft introduced
s offered. This automatic optimization often still did not provide the same result as doing it by hand, in the sense of providing the greatest free conventional memory.
Also in some cases 3rd party companies wrote special multi-function drivers that would combine the capabilities of several standard DOS drivers and TSRs into a single very compact program that used just a few kilobytes of memory. For example, the functions of mouse driver, CDROM driver, ANSI support, DOSKEY command recall, and disk caching would all be combined together in one program, consuming just 1 - 2 kilobytes of conventional memory for normal driver/interrupt access, and storing the rest of the multi-function program code in EMS or XMS memory.
s, which allowed DOS applications to run in extended memory
, but these were not very widely used outside the computer game area. As games began to use digital sound and digital image textures, they performed better if these large data components could be preloaded into megabytes of memory before playing the game rather than constantly loading the data from external storage.
The first PC operating system
s to integrate such technology were Compaq DOS 3.31 (via CEMM
) and Windows/386 2.1, both released in 1988. Since the 80286 version of Windows 2.0 (Windows/286), Windows applications did not suffer from the 640 KB barrier. Prior to DOS extenders, if a user installed additional memory and wished to use it under DOS, they would first have to install and configure drivers to support either expanded memory
specification (EMS) or extended memory
specification (XMS).
EMS was a specification available on all PCs, including the Intel 8086
and Intel 8088
which allowed add-on hardware to page small chunks of memory in and out of the "real mode" addressing space. (0x0400–0xFFFF). This required that a hole in real memory be available, typically (0xE000–0xEFFF). A program would then have to explicitly request the page to be accessed before using it. These memory locations could then be used arbitrarily until replaced by another page. This is very similar to modern virtual memory
. However, in a virtual memory system, the operating system handles all paging
operations: the programmer, for the most part, does not have to consider this.
XMS provided a basic protocol which allowed the client program to load a custom protected mode kernel. This was available on the Intel 80286
and newer processors. The problem with this approach is that while in protected mode, DOS calls could not be made. The work around was to implement a callback mechanism. On the 286, this was a major problem. The Intel 80386
, which introduced "Virtual86 mode", allowed the guest kernel to emulate the 8086 and run the host operating system without having to actually force the processor back into "real mode".
The latest DOS extension is DOS Protected Mode Interface
(DPMI), a more advanced version of XMS which provided many of the services of a modern kernel, obviating the need to write a custom kernel. It also permitted multiple protected mode clients. This is the standard target environment for the DOS port of the GCC compilers
.
There are a number of other common DOS extenders. The most notable of which is the runtime environment for the Watcom
compilers, DOS/4GW
, which was very common in games for DOS. Such a game would consist of either a DOS/4GW 32-bit kernel, or a stub which loaded a DOS/4GW kernel located in the path or in the same directory and a 32-bit "linear executable". Utilities are available which can strip DOS/4GW out of such a program and allow the user to experiment with any of the several, and perhaps improved, DOS/4GW clones.
DOS memory management
In IBM PC compatible computing, DOS memory management refers to software and techniques employed to give applications access to more than 640K of "conventional memory". The 640kB limit was specific to the IBM PC and close compatibles; other machines running MS-DOS had different limits, for example...
, conventional memory, also called base memory, is the first 640 kilobyte
Kilobyte
The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...
s of the memory on IBM PC
IBM PC
The IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...
or compatible systems. It is the read-write memory usable by the operating system and application programs. As memory prices rapidly declined, this design decision became a limitation in the use of large memory capacities until the introduction of operating systems and processors that made it irrelevant.
640 KB barrier
The 640 KB barrier is an architectural limitation of IBM and IBM PC compatibleIBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...
PCs. The Intel 8088
Intel 8088
The Intel 8088 microprocessor was a variant of the Intel 8086 and was introduced on July 1, 1979. It had an 8-bit external data bus instead of the 16-bit bus of the 8086. The 16-bit registers and the one megabyte address range were unchanged, however...
CPU, used in the original IBM PC, was able to address 1 MB (220 bytes), as the chip offered 20 address lines.
0-block | 1st 64 KB | Ordinary user memory to 64 KB |
1-block | 2nd 64 KB | Ordinary user memory to 128 KB |
2-block | 3rd 64 KB | Ordinary user memory to 192 KB |
3-block | 4th 64 KB | Ordinary user memory to 256 KB |
4-block | 5th 64 KB | Ordinary user memory to 320 KB |
5-block | 6th 64 KB | Ordinary user memory to 384 KB |
6-block | 7th 64 KB | Ordinary user memory to 448 KB |
7-block | 8th 64 KB | Ordinary user memory to 512 KB |
8-block | 9th 64 KB | Ordinary user memory to 576 KB |
9-block | 10th 64 KB | Ordinary user memory to 640 KB |
A-block | 11th 64 KB | Extended video memory (EGA Enhanced Graphics Adapter The Enhanced Graphics Adapter is the IBM PC computer display standard specification which is between CGA and VGA in terms of color and space resolution. Introduced in October 1984 by IBM shortly after its new PC/AT, EGA produces a display of 16 simultaneous colors from a palette of 64 at a... ) |
B-block | 12th 64 KB | Standard video memory (MDA/CGA Color Graphics Adapter The Color Graphics Adapter , originally also called the Color/Graphics Adapter or IBM Color/Graphics Monitor Adapter, introduced in 1981, was IBM's first color graphics card, and the first color computer display standard for the IBM PC.... ) |
C-block | 13th 64 KB | ROM expansion (XT, EGA, 3270 PC) |
D-block | 14th 64 KB | other use (PCjr cartridges, LIM EMS Expanded memory In DOS memory management, expanded memory is a system of bank switching introduced April 24, 1985 that provided additional memory to DOS programs beyond the limit of conventional memory. Expanded memory uses parts of the address space normally dedicated to communication with peripherals for program... ) |
E-block | 15th 64 KB | other use (PCjr cartridges, LIM EMS) |
F-block | 16th 64 KB | System ROM-BIOS and ROM-BASIC |
In the design of the PC, the memory below 640 KB was for random-access memory
Random-access memory
Random access memory is a form of computer data storage. Today, it takes the form of integrated circuits that allow stored data to be accessed in any order with a worst case performance of constant time. Strictly speaking, modern types of DRAM are therefore not random access, as data is read in...
on the motherboard or on expansion boards. The 384 KB above was reserved for system use and optional devices. This upper portion of the 8088 address space was used for the ROM BIOS, additional read-only memory, BIOS extensions for fixed disk drives and video adapters, video adapter memory, and other memory-mapped input and output devices
Memory-mapped I/O
Memory-mapped I/O and port I/O are two complementary methods of performing input/output between the CPU and peripheral devices in a computer...
.
The design of the original IBM PC placed the Color Graphics Adapter
Color Graphics Adapter
The Color Graphics Adapter , originally also called the Color/Graphics Adapter or IBM Color/Graphics Monitor Adapter, introduced in 1981, was IBM's first color graphics card, and the first color computer display standard for the IBM PC....
(CGA) memory map and other hardware in the 384 KB upper memory area
Upper Memory Area
In DOS memory management, the upper memory area refers to memory between the addresses of 640 KB and 1024 KB in an IBM PC or compatible. IBM reserved the uppermost 384 KB of the 8088 CPU's 1024 KB address space for ROM, RAM on peripherals, and memory-mapped input/output...
(UMA). The need for more RAM grew faster than the needs of hardware to utilize the reserved addresses, which resulted in RAM eventually being mapped into these unused upper areas to utilize all available addressable space. This introduced a reserved "hole" (or several holes) into the set of addresses occupied by hardware that could be used for arbitrary data. Avoiding such a hole was difficult and ugly and not supported by MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...
or most programs that could run on it. Later, space between the holes would be used as upper memory blocks (UMBs).
To maintain compatibility with older operating systems and applications, the 640 KB barrier remained part of the PC design even after the 8088 had been replaced with the Intel 286 processor, which could address up to 16 MB of memory. The 1 MB barrier also remained as long as the 286 was running in compatibility mode, as MS-DOS forced assumptions about how the segment and offset registers overlapped such that addresses with more than 20 bits were unsupported. It is still present in IBM PC compatibles today if they are running MS-DOS, and even in the most modern Windows-based PCs the RAM still has a "hole" in the area between 640 and 1024 KB
Kilobyte
The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...
s, which however is invisible to application programs thanks to paging
Paging
In computer operating systems, paging is one of the memory-management schemes by which a computer can store and retrieve data from secondary storage for use in main memory. In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called...
and virtual memory
Virtual memory
In computing, virtual memory is a memory management technique developed for multitasking kernels. This technique virtualizes a computer architecture's various forms of computer data storage , allowing a program to be designed as though there is only one kind of memory, "virtual" memory, which...
.
A similar 3 GB barrier
3 GB barrier
In computing, the 3 GB barrier is a limitation of some 32-bit operating systems running on x86 microprocessors. It prevents the operating systems from using more than about 3 GB of main memory...
exists, which reduces 32-bit addressing from 4 GB to 3 GB on motherboards that use memory mapped I/O. However, due to applications not assuming that the 3–4 GB range is reserved, there is no need to retain this addressing for compatibility, and thus the barrier is easily removed by using a separate address bus for hardware, and only affects a relatively small number of computers.
Additional memory
One technique used on early IBM XT computers was to ignore the extended video memory block and push the limit up to the start of the Monochrome Display AdapterMonochrome Display Adapter
The Monochrome Display Adapter introduced in 1981 was IBM's standard video display card and computer display standard for the PC. The MDA did not have any pixel-addressable graphics modes...
(MDA). Sometimes software or a custom address decoder
Address decoder
In digital electronics, an address decoder is a decoder circuit that has two or more bits of an address bus as inputs and that has one or more device selection lines as outputs. When the address for a particular device appears on the address bus, the address decoder asserts the selection line for...
was used so that attempts to use the video card memory went instead to the standard memory. This moved the barrier to 704 KB.
Memory manager
Memory manager
In IBM PC compatible computing, DOS memory management refers to software and techniques employed to give applications access to more than 640K of "conventional memory". The 640kB limit was specific to the IBM PC and close compatibles; other machines running MS-DOS had different limits, for example...
s on 386-based
Intel 80386
The Intel 80386, also known as the i386, or just 386, was a 32-bit microprocessor introduced by Intel in 1985. The first versions had 275,000 transistors and were used as the central processing unit of many workstations and high-end personal computers of the time...
systems (such as QEMM
QEMM
Quarterdeck Expanded Memory Manager , was a memory manager produced by Quarterdeck Office Systems in the late 1980s through late 1990s. It was the most popular memory manager for the MS-DOS and other DOS operating systems.-QEMM product ranges:QRAM: A memory manager for 286 or higher CPU. It...
or MemoryMax in DR-DOS
DR-DOS
DR-DOS is an MS-DOS-compatible operating system for IBM PC-compatible personal computers, originally developed by Gary Kildall's Digital Research and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86...
) could achieve the same effect, adding conventional memory at 640 KB and moving the barrier to 704 KB or 736 KB (the start of the CGA). Only CGA could be used in this situation, because Enhanced Graphics Adapter
Enhanced Graphics Adapter
The Enhanced Graphics Adapter is the IBM PC computer display standard specification which is between CGA and VGA in terms of color and space resolution. Introduced in October 1984 by IBM shortly after its new PC/AT, EGA produces a display of 16 simultaneous colors from a palette of 64 at a...
(EGA) video memory was immediately adjacent to the conventional memory area below the 640 kB line; the same memory area could not be used both for the frame buffer of the video card and for transient programs.
The AllCard, an add-on memory management unit
Memory management unit
A memory management unit , sometimes called paged memory management unit , is a computer hardware component responsible for handling accesses to memory requested by the CPU...
for XT-class computers, allowed normal memory to be mapped into the A0000-EFFFF (hex
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...
) address range, giving up to 952 KB for DOS programs. Programs such as Lotus 1-2-3
Lotus 1-2-3
Lotus 1-2-3 is a spreadsheet program from Lotus Software . It was the IBM PC's first "killer application"; its huge popularity in the mid-1980s contributed significantly to the success of the IBM PC in the corporate environment.-Beginnings:...
, which accessed video memory directly, needed to be patched to handle this memory layout. Therefore, the 640 KB barrier was removed at the cost of hardware compatibility.
It was also possible to use DOS's utility for console redirection, CTTY, to direct output to a dumb terminal or another computer running a terminal emulator. The video card could then be removed completely, and assuming the BIOS still permitted the machine to boot, the system could achieve a total memory of 960 KB of RAM. This also required that the system have at least 2 MB of physical memory in the machine. This procedure was tested on a 486 with IBM PC DOS 7.0. The total operating system footprint was around 20 KB, most of DOS residing in the high memory area (HMA).
DOS driver software and TSRs
Most standard programs written for DOS did not necessarily need 640kb or more of memory. Instead, driver software and utilities referred to as Terminate and Stay ResidentTerminate and Stay Resident
Terminate and Stay Resident is a computer system call in DOS computer operating systems that returns control to the system as if the program has quit, but keeps the program in memory...
(TSR) programs could be used in addition to the standard DOS software. These drivers and utilities typically permanently used some conventional memory, reducing the total available for standard DOS programs.
Some very common DOS drivers and TSRs using conventional memory included:
- ANSI.SYS - support for color text and different text resolutions
- ASPIxDOS.SYS, ASPIDISK.SYS, ASPICD.SYS - all must be loaded for Adaptec SCSISCSISmall Computer System Interface is a set of standards for physically connecting and transferring data between computers and peripheral devices. The SCSI standards define commands, protocols, and electrical and optical interfaces. SCSI is most commonly used for hard disks and tape drives, but it...
drives and CDROMs to work - DOSKEY.EXE - permits recall of previously typed DOS commands using up-arrow
- LSL.EXE, E100BODI.EXE (or other network driver), IPXODI.EXE, NETX.EXE - all must be loaded for Netware file server drive letter access
- MOUSE.EXE - support for mouse device in DOS programs
- MSCDEX.EXE - support for CDROM drive access and drive letter, used in combination with a separate manufacturer-specific driver. Needed in addition to above SCSI drivers for access to a SCSI CDROM device.
- SBCONFIG.EXE - support for Sound Blaster 16Sound Blaster 16The Sound Blaster 16 is a series of sound cards by Creative Technology. They are add-on boards for PCs with an ISA or PCI slot.-Sound Blaster 16:Sound Blaster 16 , the successor to the Sound Blaster Pro, introduced 16-bit digital audio sampling to the Sound Blaster line...
audio device; a differently-named driver was used for various other sound cards, also occupying conventional memory. - SMARTDRV.EXE - install drive cache to speed up disk reads and writes; although it could allocate several megabytes of memory beyond 640kb for the drive caching, it still needed a small portion of conventional memory to function.
As can be seen above, many of these drivers and TSRs could be considered practically essential to the full-featured operation of the system. But in many cases a choice had to be made by the computer user, to decide whether to be able to run certain standard DOS programs or have all their favorite drivers and TSRs loaded. Loading the entire list shown above is likely either impractical or impossible, if the user also wants to run a standard DOS program as well.
In some cases drivers or TSRs would have to be unloaded from memory to run certain programs, and then reloaded after running the program. For drivers that could not be unloaded, later versions of DOS included a startup menu capability to allow the computer user to select various groups of drivers and TSRs to load before running certain high-memory-usage standard DOS programs.
Upper memory blocks and loading high
As DOS applications grew larger and more complex in the late 1980s, it became common practice to free up conventional memory by moving the device drivers and TSR programs into upper memory blocks (UMBs) in the upper memory areaUpper Memory Area
In DOS memory management, the upper memory area refers to memory between the addresses of 640 KB and 1024 KB in an IBM PC or compatible. IBM reserved the uppermost 384 KB of the 8088 CPU's 1024 KB address space for ROM, RAM on peripherals, and memory-mapped input/output...
(UMA) at boot, in order to maximize the conventional memory available for applications. This had the advantage of not requiring hardware changes, and preserved application compatibility.
This feature began with DR-DOS
DR-DOS
DR-DOS is an MS-DOS-compatible operating system for IBM PC-compatible personal computers, originally developed by Gary Kildall's Digital Research and derived from Concurrent PC DOS 6.0, which was an advanced successor of CP/M-86...
5 and was later implemented in MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...
5. Most users used the accompanying EMM386
EMM386
The name EMM386 was used for the expanded memory managers of both Microsoft's MS-DOS and Digital Research's DR-DOS, which created expanded memory using extended memory on Intel 80386 CPUs. There also is an EMM386.EXE available in FreeDOS....
driver provided in DOS 5, but third-party products from companies such as QEMM
QEMM
Quarterdeck Expanded Memory Manager , was a memory manager produced by Quarterdeck Office Systems in the late 1980s through late 1990s. It was the most popular memory manager for the MS-DOS and other DOS operating systems.-QEMM product ranges:QRAM: A memory manager for 286 or higher CPU. It...
, also proved popular.
At startup, drivers could be loaded high using the "DEVICEHIGH=" directive, while TSRs could be loaded high using the "LOADHIGH" or "LH" directive. If the operation failed, the driver or TSR would alternately automatically load into the regular conventional memory.
config.sys, loading ANSI.SYS into UMBs, no EMS support enabled:
DEVICE=C:\DOS\HIMEM.SYS
DEVICE=C:\DOS\EMM386.EXE NOEMS
DEVICEHIGH=C:\DOS\ANSI.SYS
autoexec.bat, loading MOUSE, DOSKEY, and SMARTDRV into UMBs if possible:
LH C:\DOS\MOUSE.EXE
LH C:\DOS\DOSKEY.EXE
LH C:\DOS\SMARTDRV.EXE
The ability of MS-DOS versions 5.0 and later to move their own system core code into the high memory area (HMA) through the DOS=HIGH command gave another boost to free memory.
Driver/TSR optimization
Hardware expansion boards could use any of the upper memory area for ROM addressing, so the upper memory blocks were of variable size and in different locations for each computer, depending on the hardware installed. Some windows of upper memory could be large and others small. Loading drivers and TSRs high would pick a block and try to fit the program into it, until a block was found where it fit, or it would go into conventional memory.An unusual aspect of drivers and TSRs, is that they would use different amounts of conventional and/or upper memory, based on the order they were loaded. This could be used to advantage if the programs were repeatedly loaded in different orders, and checking to see how much memory was free after each permutation. For example, if there was a 50k UMB and a 10k UMB, and programs needing 8k and 45k were loaded, the 8k might go into the 50k UMB, preventing the second from loading. Later versions of DOS allowed the use of a specific load address for a driver or TSR, to fit drivers/TSRs more tightly together.
In MS-DOS 6, Microsoft introduced
memmaker
, which automated this process of block matching, matching the functionality third-party memory managerMemory manager
In IBM PC compatible computing, DOS memory management refers to software and techniques employed to give applications access to more than 640K of "conventional memory". The 640kB limit was specific to the IBM PC and close compatibles; other machines running MS-DOS had different limits, for example...
s offered. This automatic optimization often still did not provide the same result as doing it by hand, in the sense of providing the greatest free conventional memory.
Also in some cases 3rd party companies wrote special multi-function drivers that would combine the capabilities of several standard DOS drivers and TSRs into a single very compact program that used just a few kilobytes of memory. For example, the functions of mouse driver, CDROM driver, ANSI support, DOSKEY command recall, and disk caching would all be combined together in one program, consuming just 1 - 2 kilobytes of conventional memory for normal driver/interrupt access, and storing the rest of the multi-function program code in EMS or XMS memory.
DOS extenders
The barrier was only overcome with the arrival of DOS extenderDOS extender
A DOS extender is a computer software program which enables software to run under a protected mode environment even though the host operating system is only capable of operating in real mode....
s, which allowed DOS applications to run in extended memory
Extended memory
In DOS memory management, extended memory refers to memory above the first megabyte of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems...
, but these were not very widely used outside the computer game area. As games began to use digital sound and digital image textures, they performed better if these large data components could be preloaded into megabytes of memory before playing the game rather than constantly loading the data from external storage.
The first PC operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
s to integrate such technology were Compaq DOS 3.31 (via CEMM
CEMM
CEMM, for Compaq Expanded Memory Manager was the first so-called PC "memory manager" for Intel 80386 CPUs, able to transform "XMS" extended memory into "EMS" expanded memory by using the virtual memory features and the virtual 8086 mode of the CPU....
) and Windows/386 2.1, both released in 1988. Since the 80286 version of Windows 2.0 (Windows/286), Windows applications did not suffer from the 640 KB barrier. Prior to DOS extenders, if a user installed additional memory and wished to use it under DOS, they would first have to install and configure drivers to support either expanded memory
Expanded memory
In DOS memory management, expanded memory is a system of bank switching introduced April 24, 1985 that provided additional memory to DOS programs beyond the limit of conventional memory. Expanded memory uses parts of the address space normally dedicated to communication with peripherals for program...
specification (EMS) or extended memory
Extended memory
In DOS memory management, extended memory refers to memory above the first megabyte of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems...
specification (XMS).
EMS was a specification available on all PCs, including the Intel 8086
Intel 8086
The 8086 is a 16-bit microprocessor chip designed by Intel between early 1976 and mid-1978, when it was released. The 8086 gave rise to the x86 architecture of Intel's future processors...
and Intel 8088
Intel 8088
The Intel 8088 microprocessor was a variant of the Intel 8086 and was introduced on July 1, 1979. It had an 8-bit external data bus instead of the 16-bit bus of the 8086. The 16-bit registers and the one megabyte address range were unchanged, however...
which allowed add-on hardware to page small chunks of memory in and out of the "real mode" addressing space. (0x0400–0xFFFF). This required that a hole in real memory be available, typically (0xE000–0xEFFF). A program would then have to explicitly request the page to be accessed before using it. These memory locations could then be used arbitrarily until replaced by another page. This is very similar to modern virtual memory
Virtual memory
In computing, virtual memory is a memory management technique developed for multitasking kernels. This technique virtualizes a computer architecture's various forms of computer data storage , allowing a program to be designed as though there is only one kind of memory, "virtual" memory, which...
. However, in a virtual memory system, the operating system handles all paging
Paging
In computer operating systems, paging is one of the memory-management schemes by which a computer can store and retrieve data from secondary storage for use in main memory. In the paging memory-management scheme, the operating system retrieves data from secondary storage in same-size blocks called...
operations: the programmer, for the most part, does not have to consider this.
XMS provided a basic protocol which allowed the client program to load a custom protected mode kernel. This was available on the Intel 80286
Intel 80286
The Intel 80286 , introduced on 1 February 1982, was a 16-bit x86 microprocessor with 134,000 transistors. Like its contemporary simpler cousin, the 80186, it could correctly execute most software written for the earlier Intel 8086 and 8088...
and newer processors. The problem with this approach is that while in protected mode, DOS calls could not be made. The work around was to implement a callback mechanism. On the 286, this was a major problem. The Intel 80386
Intel 80386
The Intel 80386, also known as the i386, or just 386, was a 32-bit microprocessor introduced by Intel in 1985. The first versions had 275,000 transistors and were used as the central processing unit of many workstations and high-end personal computers of the time...
, which introduced "Virtual86 mode", allowed the guest kernel to emulate the 8086 and run the host operating system without having to actually force the processor back into "real mode".
The latest DOS extension is DOS Protected Mode Interface
DOS Protected Mode Interface
In computing, the DOS Protected Mode Interface is a specification introduced in 1989 which allows a DOS program to run in protected mode, giving access to many features of the processor not available in real mode...
(DPMI), a more advanced version of XMS which provided many of the services of a modern kernel, obviating the need to write a custom kernel. It also permitted multiple protected mode clients. This is the standard target environment for the DOS port of the GCC compilers
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
.
There are a number of other common DOS extenders. The most notable of which is the runtime environment for the Watcom
Watcom
Watcom International Corporation was founded in 1981 by three former employees of the Computer Systems Group at the University of Waterloo, in Waterloo, Ontario, Canada...
compilers, DOS/4GW
DOS/4GW
DOS/4G is a 32-bit DOS extender developed by Rational Systems . It allows DOS programs to eliminate the 640 KB conventional memory limit by addressing up to 64 MB of extended memory on Intel 80386 and above machines....
, which was very common in games for DOS. Such a game would consist of either a DOS/4GW 32-bit kernel, or a stub which loaded a DOS/4GW kernel located in the path or in the same directory and a 32-bit "linear executable". Utilities are available which can strip DOS/4GW out of such a program and allow the user to experiment with any of the several, and perhaps improved, DOS/4GW clones.
See also
- Expanded memoryExpanded memoryIn DOS memory management, expanded memory is a system of bank switching introduced April 24, 1985 that provided additional memory to DOS programs beyond the limit of conventional memory. Expanded memory uses parts of the address space normally dedicated to communication with peripherals for program...
(EMS) - Extended memoryExtended memoryIn DOS memory management, extended memory refers to memory above the first megabyte of address space in an IBM PC or compatible with an 80286 or later processor. The term is mainly used under the DOS and Windows operating systems...
(XMS) - High memory area (HMA)
- loadhighLoadhighLoadhigh is an internal MS-DOS command that is used to load a program into the upper memory area instead of conventional memory. Due to design of the IBM PC MS-DOS suffered from what was known as the 640 KiB barrier. The size of this memory area, known as conventional memory was fixed and...
- Long modeLong modeIn the x86-64 computer architecture, long mode is the mode where a 64-bit application can access 64-bit instructions and registers...
- Protected modeProtected modeIn computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units...
- Real modeReal modeReal mode, also called real address mode, is an operating mode of 80286 and later x86-compatible CPUs. Real mode is characterized by a 20 bit segmented memory address space and unlimited direct software access to all memory, I/O addresses and peripheral hardware...
- 3 GB barrier3 GB barrierIn computing, the 3 GB barrier is a limitation of some 32-bit operating systems running on x86 microprocessors. It prevents the operating systems from using more than about 3 GB of main memory...
- Unreal modeUnreal modeIn x86 computing, unreal mode, also big real mode, huge real mode, or flat real mode, is a variant of real mode , in which one or more data segment registers have been loaded with 32-bit addresses and limits. Contrary to its name, it is not a separate addressing mode that the x86-32 and x86-64...
- Upper memory areaUpper Memory AreaIn DOS memory management, the upper memory area refers to memory between the addresses of 640 KB and 1024 KB in an IBM PC or compatible. IBM reserved the uppermost 384 KB of the 8088 CPU's 1024 KB address space for ROM, RAM on peripherals, and memory-mapped input/output...
(UMA) - x86 memory segmentation