0% found this document useful (0 votes)
61 views

Os Term PPR

The document discusses strategies for memory management in DOS. It describes how DOS used conventional memory below 640KB, as well as upper memory areas, expanded memory, and extended memory to access RAM beyond the 640KB limit. It discusses standards for expanded memory and how different processors like the 80286 and 80386 addressed this issue.

Uploaded by

Binayak Goswami
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Os Term PPR

The document discusses strategies for memory management in DOS. It describes how DOS used conventional memory below 640KB, as well as upper memory areas, expanded memory, and extended memory to access RAM beyond the 640KB limit. It discusses standards for expanded memory and how different processors like the 80286 and 80386 addressed this issue.

Uploaded by

Binayak Goswami
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

TERM PAPER CSE-316

Topic:- Strategies for Memory management in DOS

Submitted By: NAME:- Kishor kunal REG NO:-10902863 ROLL NO:-A26

Submitted To:- preetpal mam

Contents

1. DOS memory management 2. Conventionalmemory 3. Upper memory area 4. Expanded memory 5. Expanded memory standards 6. The 80286 and the high memory area 7. 80386 and subsequent processors
8. Extended memory 9. DOS Memory Management Services

10.High Memory Area 11.Shadow Ram 12.Cache Ram


13.Allocate DOS Memory Block 14. Free DOS Memory Block 15. References

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 the Apricot PC could have up to 768kB and the Sirius Victor 9000, 896kB. Memory management on the IBM family was made complex by the need to maintain backward compatibility to the original PC design [1]and real-mode PC DOS (MS DOS), while allowing computer users to take advantage of large amounts of low-cost memory and new generations of processors. Since MS DOS has given way to Windows and other 32-bit operating systems not restricted by the original arbitrary 640kB limit of the IBM PC, managing the memory of a personal computer no longer requires the user to manually manipulate internal settings and parameters of the system. The 640kB limit imposed great complexity on hardware and software intended to circumvent it; the physical memory in a machine could be organised as a combination

of base or conventional memory, upper memory, high memory (not the same as upper memory), extended memory, and expanded memory, all handled in different ways.

Conventional memory

The 8088 processor used in the original IBM PC had 20 address lines and so could directly address 1 megabyte of memory. Different areas of this address space were allocated to different kinds of memory used for different purposes. Starting at the lowest end of the address space, the PC had read/write memory (RAM) installed, which was used by PC DOS and application programs. The first part of this memory was installed on the motherboard of the system (in very early machines, 64 kilobytes, later revised to 256 kilobytes). Additional memory could be added on cards plugged into the expansion slots; each card contained straps or switches to control what part of the address space access memory and devices on that card.

On the IBM PC, all the address space up to 640 kilobytes was available for RAM. This part of the address space is called "conventional memory" since it accessible to all versions of PC DOS (and MS DOS) automatically on start up. Normally expansion memory is set to be contiguous in the address space with the memory on the motherboard. If there was an unallocated gap between motherboard memory and the expansion memory, the memory would not be automatically detected as usable by PC DOS.

0xFFFFF for the BIOS and Cassette BASIC read-only memory (ROM). For example, the monochrome video adapter memory area runs from 704 to 736 KB (0xB00000xB7FFF). If only a monochrome display adapter was used, the address space between 0xA0000 and 0xAFFFF could be used for RAM, which would be contiguous with the conventional memory. The system BIOS ROMs must be at the upper end of the address space because the CPU starting address is fixed by the design of the processor. The starting address is loaded into the program counter of the CPU after a hardware reset and must have a defined value that endures after power is interrupted to the system. On reset or power up, the CPU loads the address from the system ROM and then jumps to a defined ROM location to begin executing the system power-on self test, and eventually load an operating system. Since an expansion card such as a video adapter, hard drive controller, or network adapter could use allocations of memory in many of the upper memory areas, configuration of some combinations of cards required careful reading of documentation, or experimentation, to find card settings and memory mappings that worked. Mapping two

Upper memory area

The upper memory area (UMA) refers to the address space between 640 KB and 1024 KB (0xA0000 0xFFFFF). Three 128 kB regions were defined in this area. The 128 kB between 0XA0000 and 0xBFFFF was reserved for video adapter screen memory. The physical address space between 0xC0000 and 0xDFFFF was reserved for device BIOS ROMs, and special RAM usually shared with physical devices (for example, shared memory for a network adapter). The IBM PC reserved the uppermost 128 KB of the address space from 0xE0000 to

devices to use the same physical memory addresses could result in a stalled or unstable system. [2] Not all addresses in the upper memory area were used in a typical system; unused physical addresses would return undefined and systemdependent data if accessed by the processor.

the processor's address space. For the PC and XT, with only 20 address lines, special-purpose expanded memory cards were made containing perhaps a megabyte, or more, of expanded memory, with logic on the board to make that memory accessible to the processor in defined parts of the 8088 address space. Allocation and use of expanded memory was not transparent to application programs. The application had to keep track of which bank of expanded memory contained a particular piece of data, and when access to that data was required, the application had to request (through a driver program) the expanded memory board to map that part of memory into the processor's address space. Although applications could use expanded memory with relative freedom, many other software components such as drivers and TSRs were still normally constrained to reside within the 640K "conventional memory" area, which soon became a critically scarce resource.

Expanded memory

As memory prices declined, application programs such as spreadsheets and computer-aided drafting were changed to take advantage of more and more physical memory in the system. Virtual memory in the 8088 and 8086 was not supported by the processor hardware, and disk technology of the time would make it too slow and cumbersome to be practical. Expanded memory was a system that allowed application programs to access more RAM than directly visible to the processor's address space. The process was a form of bank switching. When extra RAM was needed, driver software would temporarily make a piece of expanded memory accessible to the processor; when the data in that piece of memory was updated, another part could be swapped into

Expanded memory standards

When looking at expanded memory, one must also take into account such factors as the type of expanded memory being made available. The first widely accepted standard was the Lotus-Intel-Microsoft Expanded Memory Specification (LIM EMS) version 3.2. This provided a way for programs to store information in expanded memory, but did not allow for efficient movement of information or the storing of the actual program. Lotus 1-2-3, for example, could store only cell labels and not values in expanded memory, restricting the real value of this type of expanded memory. Other standards that were developed later included AST's Enhanced Expanded Memory Specification (EEMS) and IBM's Expanded Memory Adapter (XMA). Once combined under LIM EMS version 4.0, these allowed better use of expanded memory. The features in LIM EMS 4.0 include increased page size and the ability to position the page windows anywhere in memory. Version 4.0 allowed programs to load executable code into expanded memory, since the page could be made to appear to be from memory in the 0-640K DOS memory range.

Most memory boards currently offer some sort of LIM EMS 4.0 support but you will still pay a performance penalty unless the board offers full hardware support for LIM EMS 4.0. (Some boards offer software drivers to give the board LIM EMS 4.0 compatibility.)

Under DOS, applications must explicitly use either expanded or extended memory. Lotus 1-2-3 release 3.1 and Microsoft Windows require that extended memory be available in order to operate. Most other DOS programs will use expanded memory only to get around the DOS 640K barrier. Some of the commercial memory management software for the 80386 chip will actually switch memory from expanded to extended memory if a program asks for it.

Under OS/2 or Unix, there is no need for expanded memory because you do not run them on 8088s. The term "extended" memory loses meaning because all the physical memory is available and is allocated to the programs as needed.

The 80286 and the high memory area

When the IBM AT was introduced, the segmented memory architecture of the Intel family processors had the byproduct of allowing slightly more than 1 megabyte of memory to be addressed in the "real" mode. Since the 80286 had more than 20 address lines, certain combinations of segment and offset could point into memory above the 0x010000 (2^21) location. To maintain compatibility with the PC and XT behavior, the AT included an A20 line gate that made the AT address wrap around to low memory as they would have on an 8088 processor. This gate could be controlled, initially through the keyboard controller, to allow running programs which wanted to access an additional 64 kB - 16 bytes of memory in real mode. In DOS memory management, the high memory area (HMA) is the RAM area consisting of the first 64 kibibytes (KiB), minus 16 bytes, of the extended memory on an IBM AT or compatible microcomputer. So-called A20 handlers could control the addressing mode dynamically, thereby allowing programs to load themselves into the 10241088 KB region and run in real mode. The first user of the HMA among Microsoft products was Windows/286 2.1 in 1988,

which introduced the HIMEM.SYS device driver. Starting with versions 5.0 of DR-DOS (1990) and of MSDOS (1991), parts of the operating system could be loaded into HMA as well, freeing up to 46 KB of conventional memory. Other components, such as device drivers and TSRs, could be loaded into the upper memory area (UMA)

80386 and processors

subsequent

Intel processors of the 386 version and later allowed a virtual 8086 mode, which simplified the hardware required to implement expanded memory for MS DOS applications. Expanded memory managers such as Quarterdeck's QEMM product and Microsoft's EMM386 supported the expanded memory standard without requirement for special memory boards. On 386 and subsequent processors, memory managers like QEMM might move the bulk of the code for a driver or TSR into extended memory and replace it with a small fingerhold that was capable of accessing the extended-memoryresident code. They might analyze memory usage to detect drivers that

required more RAM during startup than they did subsequently, and recover and reuse the memory that was no longer needed after startup. They might even remap areas of memory normally used for memorymapped I/O. Many of these tricks involved assumptions about the functioning of drivers and other components. In effect, memory managers might reverse-engineer and modify other vendors' code on the fly. As might be expected, such tricks did not always work. Therefore, memory managers also incorporated very elaborate systems of configurable options, and provisions for recovery should a selected option render the PC unbootable (a frequent occurrence). Installing and configuring a memory manager might involve hours of experimentation with options, repeatedly rebooting the machine, and testing the results. But conventional memory was so valuable that PC owners felt that such time was well-spent if the result was to free up 30K or 40K of conventional memory space.

In the context of IBM PC compatible computers, extended memory refers to memory in the address space of the 80286 and subsequent processors, beyond the 1 megabyte limit imposed by the 20 address lines of the 8088 and 8086. Such memory is not directly available to PC DOS (MS DOS) applications running in the so-called "real mode" of the 80286 and subsequent processors. This memory is only accessible in the protected or virtual modes of 80286 and higher processors.

DOS Memory Management Services

Some applications require the ability to allocate memory in the real mode addressable 1 megabyte region. These services allow protected mode applications to allocate and free memory that is directly addressable by real mode software such as networks and DOS device drivers. Often, this memory is used in conjunction with the API translation services to call real mode software that is not directly supported by DPMI.

Extended memory

High Memory Area

High memory area is an area slightly smaller than 64Kb starting at the 1024Kb boundary, available only on 286 or higher computers. Due to the design of the memory addressing of Intel microprocessors, you can address this space in real mode without switching to protected mode. With appropriate software, you can load device drivers and TSRs into this region as well. Quaterdeck's Desqview uses the high memory area, as does Windows 3.x and DOS 5.0 and up.

Shadow Ram
Shadow ram is memory that is used to "shadow" ROM chips. Because ROM chips are typically very slow to access, many system operations (i.e., cases where the applications call the system BIOS or other ROMs) can be sped up by copying their contents to RAM, and then using special hardware (like the C&T chipset, or the abilities of the 386 chips and up) to make the memory appear where the ROM's should be. This strategy is being used less often, as the speed-up is sometimes not worth the extra memory-management hassles for the end-user. To read more about ROM.

VCPI (Virtual Control Program Interface) and DPMI (DOS Protected Mode Interface) are API's (Application Programming Interfaces) that make it possible for software to take advantage of the special capabilities of the 386 chips and up without getting in each other's way. The domain for these standards go beyond simple memory management, but they often include EMS and XMS support as well. VCPI services are provided by QEMM/Desqview and most of the DOS extenders currently on the market; DMPI is somewhat newer (and more capable) and currently is supported primarily in Microsoft Windows.

Cache Ram
Cache ram is very high-speed RAM chips which sit between the CPU and main memory. It stores (i.e., caches) memory accesses by the CPU. Cache ram helps to alleviate the gap between the speed of a CPU's megahertz rating and the ability of RAM to respond and deliver data. It reduces the frequency that the CPU must wait for data from the main memory.

Allocate DOS Memory Block

Free DOS Memory Block

This function will allocate a block of memory from the DOS free memory pool. It returns both the real mode segment and one or more descriptors that can be used by protected mode applications to access the block.
To Call AX = 0100h BX = Number of paragraphs (16 byte blocks) desired

This function frees memory that was allocated through the Allocate DOS Memory Block function.
To Call AX = 0101h DX = Selector of block to free Returns If function was successful: Carry flag is clear. If function was not successful: Carry flag is set. AX = DOS error code: 07h memory control blocks damaged 09h incorrect memory segment specified

Returns If function was successful: Carry flag is clear. AX = Initial real mode segment of allocated block DX = Selector for allocated block If function was not successful: Carry flag is set. AX = DOS error code: 07h memory control blocks damaged 08h insufficient memory available to allocate as

References 1. http://www.dewassoc.com/support/msdos/msdos_memory.ht m 2. http://en.wikipedia.org/wiki/Memory_management 3. http://support.microsoft.com/kb/95555 4. http://en.wikipedia.org/wiki/DOS_memory_management 5. http://www.tenberry.com/dpmi/09.html

You might also like