Nifty memory tricks
Brian Pereira | 15 September 2006
|Bill Gates, the erstwhile head of Microsoft once said, “640 KB ought to be enough for anybody!” This statement was made in the early 90s, when DOS was the de facto PC operating system. And of course, it lacks foresight. A few years later the PC hardware industry struggled with the problem of memory addressability, beyond the 640 KB and 1 MB limits. To overcome that, the industry resorted to memory tricks, the genius of system software programmers.|
First generation PCs of the mid-80s had severe memory limitations because of the width of the address bus. The 8086, a 16-bit system, had an address bus 20-bits wide, and hence the maximum addressable memory was 1 MB. But not all of that precious 1 MB was available to software applications. In fact, just the first 640 KB (conventional memory) was up for grabs, on a first come, first serve basis.
The next 384 KB of estate was called Upper Memory Area, and reserved for drivers, video RAM, ROM routines, and other system information.
After loading DOS, BIOS communication routines, and Terminate and Stay Resident Programs (TSRs) you had some conventional memory left for applications. If that application was a hefty one like Lotus 123 (the de facto spreadsheet in those days), you’d soon get the “Insufficient Memory” system error message.
There were a few blocks in the upper memory area that were reserved and unused. These areas were called Upper Memory Blocks (UMBs). With some clever programming, certain things like drivers and TSRs could be shifted to the UMBs, thereby freeing up conventional memory. The applications that did such juggling acts were called Memory Maximizers. The HIMEM.SYS and EMM386.EXE drivers are prime examples.
As memory boards (see picture) became available, manufacturers modified the architecture to accommodate expanded memory. But the 1 MB memory limit continued to be a pesky problem. So once again programmers wrote applications to swap memory pages between expanded memory (on memory cards) and the UMBs.
Once the 80286 systems came along, memory addressability was increased to 16 MB. And with the advent of 32-bit systems like the 80386 and 80486, you could go all the way to 4 GB (though we are yet to see PCs with 4 GB memory today). Windows 95 improved memory management, significantly.
Virtual memory paging is another memory trick, accomplished by the memory manager VMM386.exe. It was introduced as multitasking came to PCs (with Windows and 80386 systems); in fact it is still used today.
I am also awed by other memory shuffling tricks like the DOS Diskcopy utility and Windows Defrag.
Using a single floppy drive in the PC, Diskcopy gave us the freedom to make exact replicas of floppy disks. Depending on the amount of content on the floppy, and the capacity of memory, you had to keep swapping the master disk and its copy a number of times in the single drive. With repeated swapping, the contents from the master would be copied to another disk via main memory.
The Windows defrag utility also uses main memory to tidy up file storage on the hard disk. It picks up a cluster of a fragmented file and copies it into main memory. Then it writes that cluster back to disk in such a manner that all the file’s clusters end up sequentially. And you could see a graphical rendition of this in the Windows 98 defrag utility.
Going forward, I expect memory density to cross the 1 Gbit threshold. Then memory will catch up with hard disks, on the capacity front. When that happens, you’ll see hybrid systems that use both Flash memory and hard disk for permanent storage.
Earlier this year, Samsung announced that it will build hybrid hard disk systems for notebooks. The Flash memory section will be used for caching frequently used applications. Eventually, there’ll be only “solid state disks”.