Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers

ArticlesTo Cure a Failing Memory


February 1998 / Pournelle / To Cure a Failing Memory

Jerry's unending quest for more storage space and more RAM leads him into the thicket of disk and memory optimization.

Jerry Pournelle

Today's Daily News has a Fry's ad: 3.2-GB drives for $160, an astonishing $50 per gigabyte. I suspect that by the time you see this, that price will be standard. This makes disk storage so cheap there's no reason not to have a lot of it without disk compression.

This should have a large impact on Web computers and the like. In a recent Weekly Standard, Britt Hume mentions "industry analysts who foresee the day when you won't need to keep any programs stored on your computer except your Web browse r." He doesn't say why anyone would be foolish enough to leave critical programs and data at the mercy of not only the telephone lines b ut the financial stability of a service provider when storage is so cheap. David Em has more on why you need storage space in his graphics report in the Web Exclusive part of this column.

However, large drives do require good disk utilities. You can start with PartitionMagic, from PowerQuest. PartitionMagic partitions your disk; once you've tried it, you won't go back to FDISK. It also examines your disk's partition structure and lets you change it painlessly.

For instance: Cyrus, my Cyrix 6x86 P-166 system, has (according to Windows 95) a 4.4-GB Barracuda drive partitioned into two 2.2-GB drives. Because most programs like to store themselves in C:\Program Files, I'm running low on disk space on the C drive.

There are several remedies. One is to move a lot of data files to the D drive and update the defaults in Microsoft Of fice and other data-using programs. That works, but it complicates making backup copies; besides, for much of my stuff, I have already done that.

Another remedy is to move a lot of program files from C:\Program Files to S:\Program Files (i.e., to the big dual-Pentium server that hides in the cable room) and access those programs through the network. For some programs this is simple. Others will want the original installation disks -- and I don't have them all, meaning I'll have to edit the Registry, which is just a bit more fun than root-canal surgery. Since Cyrus won't be my main machine much longer -- I'm changing over to Princess, the Compaq Workstation 5000 that runs Windows NT -- I don't need a permanent solution, just a way to get a bit more space.

The first thing I did was install PartitionMagic. That uses about 6 MB of disk space, but it's easily uninstalled. More to the point, the program will tell me how much I can gain by repartitioning my hard drive, so I can use smaller cluster sizes.

Forgive me if you know all about cluster sizes. Some readers don't, so I'd better explain. It's also laid out clearly and in detail in the generally excellent PartitionMagic manual.

I'll summarize by saying that the bigger your logical disk drive, the larger the cluster size. The cluster size is the minimum space required to store all or part of a file. In particular, drives sized from 1024 to 2047 MB must, under the current DOS/Windows 95 OS, have a minimum cluster size of 32 KB -- and that becomes the smallest file size on your disk.

Thus, if you have a tiny ASCII file, say AUTOEXEC.BAT, the file size may be 88 bytes, but that file will still take up 32 KB on your disk. This wastes space, typically about 30 percent. The larger the partition size, the worse it gets; the wastage can approach 50 percent on systems that have a number of small files.

The remedy is to break that disk partition down to something smaller. A partition smaller than 1 GB, for instance, can use 16-KB clusters and typically results in less than 20 percent wasted space. If you're really into disk organization, you can make one large partition for large files (e.g., the swap file and some program suites), one intermediate size for medium files (e.g., normal program files), and one small partition for little files like saved e-mail. I don't really recommend you do this. I just point out that it's possible.

I was concerned that Windows 95 showed my drives as 2.2 GB, larger than the maximum for 32-KB clusters, making me wonder if I was wasting more space than I needed to by using 64-KB clusters. There may be a way to make Windows 95 tell you what your cluster size is, but I don't know it. Thus, I installed PartitionMagic.

It told me that although Windows 95 thinks my drives are 2.2 GB each, they're really only 2047 MB, and my total wasted space is about 457 MB, or 19 percent. (It also turns out that 64-KB clusters are supported only in NT, not in Windows 95.) I could cut back on the wastage by partitioning t he D drive into a D drive for program files and an E drive with 16-KB clusters for saved e-mail. However, it hardly seems worthwhile to recover at most 100 MB of disk space. Also, smaller cluster sizes come at a price: with small clusters, it takes longer to access large files, because the disk heads have to move a lot more. If you do make small partitions, don't put your swap file on one of them; it can slow your system down something awful.

There's an even more drastic way to recover that wasted space. I could get the latest version of Windows 95 (version 4.00.950B or later; you can find your version number in Control Panel/System), which includes FAT32, the new 32-bit file allocation table (FAT) system that allows 8-GB disk partitions with 4-KB cluster sizes.

The problem here is that there's no upgrade to FAT32; you have to back up all files, reformat, and start over. Then, too, the "B" version is still OEM-only. I've heard rumors of an imminent upgrade version, but there isn't one yet. I suspe ct this is because, while BYTE readers may understand that installing FAT32 is a one-way operation, many users won't.

FAT32 can't share a partition with normal FAT files, nor can earlier versions of Windows 95 (or NT4.0) read FAT32 files. This applies only to reading local disk partitions; it doesn't affect the ability to access files through a network. A Windows 3.1 system can see and read FAT32 files on a connected system, and vice versa. Of course, if you use a network to move files to a FAT32 system, that is all transparent.

FAT32 is built into Windows 98(aka Memphis) and is clearly the right way to go, giving you large disk partitions without the penalties of large cluster sizes. However, retrofitting with it isn't something lightly undertaken, even for someone as networked as I am. One day I'll do it, but I'm in no big hurry.

I concluded that to get more space I'd have to either migrate stuff to the server or experiment with disk compression. My last experience with disk compressi on was pretty grim, but I have a new program, Mijenix's FreeSpace, that promises compression without pain or fuss. I was skeptical, but it sounded good.

Compression does two things. First, it squeezes redundancy out of files by encoding them. Second, it packs many small files into what the OS sees as one large file, thus eliminating wastage caused by large cluster sizes. The problem with compression is a mirror image of its virtue. To retrieve a file, something has to extract that file from the large compacted file it was stored in and then decode the file into its original form. None of this has to be unreliable, but it adds some complexities to file access.

Now suppose we want to add to that file. We have to find room for the new length and then repack everything. Finally, since many of your compressed files are stuffed end to end into one large packed file, if anything happens to that large file, you could lose them all. Apparently that doesn't happen very often, but it's a chance I'm not eager to take.

FreeSpace is a file (not disk) compression utility with a nifty management structure and a simple user interface. Basically, you install FreeSpace, tell it how much disk space you'd like to make, and stand back. It will recommend which files and folders to compress to get that much. That seemed too good to be true.

First thing, then, was to defrag the disk. There are several ways to do that but only one I trust: Golden Bow Systems' Vopt. I have been using one or another version of Vopt since early DOS days, and I have not had a single problem. Vopt is very careful; it's also considerably more efficient than any other defrag program I've used. When you Vopt a disk, it's really optimized.

I ran Vopt and installed FreeSpace. I told FreeSpace I wanted to free up 20 MB. The analyzer wizard trundled and then recommended that I compress the Grolier encyclopedia folder. I told it to go ahead, and less than 5 minutes later, I had 22 MB more disk space.

The Grolier program has about 30 MB of stuff on my local disk; it gets the rest from a CD-ROM that resides on a Pioneer SCSI6-Pack CD-ROM drive on the server. When I ran the encyclopedia, I couldn't detect any difference in its operation after the file compression. Everything works just fine, and if there's a speed difference, I don't notice it.

I was curious now. I used Symantec's Commander 95 and Explorer to look at that folder to see what FreeSpace did; and I blush to say I don't know. If you right-click on some of the files, you'll see a new menu item, FreeSpace, and that will offer to decompress the file. Otherwise, there is no clue that any files have been compressed. Still, Explorer reports 20 MB more disk space available.

It still looked too good to be true, so I told the FreeSpace wizard that I wanted another 40 MB on the C drive. For good measure, it should find me 20 MB on the D drive. It did. On the D drive, there are a huge bunch of mail files, and a lot of game files on the C drive. Once again, if there's any effe ct on performance, I can't find it.

Then I ran Vopt again. One of the things that used to drive me mad about disk compression on OS/2 was that I had to go to extraordinary lengths to defrag a compressed disk. With FreeSpace, I just run Vopt. When I did, it showed that the disk was seriously fragmented. Apparently, when FreeSpace compresses files, it compacts the ones it compresses, but that can leave a lot of fragmentation among the other files. Vopt soon fixed that.

The bottom line is that FreeSpace has painless compression and decompression. It's extremely easy to use. It will analyze your hard disk folder by folder to determine just how much space it can make for you; and it works just fine. None of my disk utilities know there were any changes in the disk structure; they just see some extra disk space. In fact, it's very hard to see just how FreeSpace works this magic.

FreeSpace doesn't work as well on NT, and clearly it's not going to do much for you in compressing files like JPEGs, whi ch have already been compressed. However, as a quick-and-dirty way to make some more disk space in a hurry, this thing is a blooming miracle. Laptop users with their truly limited disk space will absolutely love this product. Recommended.

Vopt is written by Barry Emerson, who seems to know more about DOS and Windows file operations than anyone I know , including Microsoft's people. Vopt has been on my recommended list just about forever. (Truth in reporting: Elizabeth Emerson of Golden Bow has won my "bribe of the month" award several times for elaborate chocolate Christmas presents, but that's not why I like Vopt.) Anyway, about the time you read this, there will be a new version for NT as well as some improvements in the Windows 95 version.

Vopt shows you exactly what is going on, gives a map of just how fragmented your disk is, and works at lightning speed. It's a lot faster than its rivals, despite the fact that it's also more thorough. Disk fragmentation can be a serious problem, especial ly if you do much Internet surfing. Internet browsers create and delete scads of temporary files. Surfing for a few nights can reduce my hard disk to chattering inefficiency bad enough to make me think the old "hesitation" curse is back with me. Vopt fixes that. Highly recommended.

Actually, I should say that Vopt is a partial cure. I have had hesitations in Word again. I suspected they were caused by disk operations; making disk operations more efficient reduces the time the computer's attention is turned to them. That helps.

But I went further: I wanted to know why all the disk operations. What I found out makes a long story -- you'll have to read it in the Web Exclusive part of the column -- that ended with my installing and uninstalling Quarterdeck Systems' CleanSweep. The reason? I was routinely exceeding Cyrus's 32 MB of memory.

Speaking of Quarterdeck, some time ago, I said that I didn't see much improvement from their MagnaRam. That turns out to be wrong.

Even though I man aged to get my memory usage down below 32 MB by uninstalling CleanSweep, it was still hovering around there, and my stupid hesitations in Word continued. About then, my son Richard spotted the newest QEMM97 and mentioned that he thought MagnaRam, which is included with QEMM97, had helped his system.

I figured anything was worth a try, so I installed QEMM97, which automatically installs MagnaRam, a program that claims to do for RAM what FreeSpace does for disk space, on-the-fly compression. The results were amazing: my hesitations ceased, most disk-swapping operations ceased, and things are very stable. The decrease in disk-swapping operations has been dramatic.

One warning: by default, QEMM97 installs Update-It, a memory-resident program that will go look for Quarterdeck updates on the Internet. That uses several megabytes of memory and surely is not needed. Kill it fast.

Back in DOS and early Windows days, I found QEMM, Quarterdeck's memory manager, indispensable, and I said so often. When Windows 95 rolled out, it didn't look like there was much need for third-party memory-manager programs.

I was wrong. QEMM97 works like a charm, adding memory and resources to your Windows 95 system. While I haven't been using it for all that long, Richard has, and neither of us has had any problems with it so far. It works fine with FreeSpace and Norton System Doctor, its control panel gives you a lot of useful information, and it instantly ended my newest round of hesitations. Recommended.

While I was talking with Barry Emerson about improvements to Vopt, he told me something disturbing. Disk defrag programs move massive amounts of data around. To make sure that everything works properly, Vopt does cyclic redundancy check (CRC) checksums on each file that it moves. Barry has found that in about every 500 GB of data moved, there will be one bit flip: a 0 has become a 1, or vice versa.

He has no idea what causes this; it does not seem to be specific to any kind of file or any kind of ha rdware. It may be temperature-dependent, but that's an impression; when an event is that rare, it's hard to get decent statistics. "It may be cosmic rays for all I know," he said.

One bit flip in 500 GB is a very low error rate; but given current massive data transfers, it's frightening. The odds are pretty good that the bit flip will be inconsequential or that it will cause a fatal error requiring you to restart whatever operation you were engaged in; but there remains that tiny chance that the bit will flip in an important data file and never be noticed.

I honestly don't know what, if anything, I can do about this. Thus, I merely report it. But it disturbs me.

Now an apology. The comedy of errors started in my November column. CyberMedia's Oil Change recommended that we download DUN1.2, a Microsoft upgrade to Dial-Up Networking. We did that. We also read about a utility called TweakDUN, from Patterson Design Systems. It's recommended and apparently codeveloped by NetPro NorthWest; you can find them at http://www.sns-access.com/~netpro/maxmtu.htm#tweakdun , which goes into great detail on what TweakDUN does and why you need it.

We downloaded TweakDUN as well as DUN1.2 and used them together on Cyrus, which I'm writing this on. They seemed to improve network operations considerably, and the new DUN is certainly more convenient; so we installed them on another machine. The result was a minor disaster that ended with us reinstalling Windows 95; you can read about it in the November issue.

After the November issue came out, I got e-mail from NetPro NorthWest. It has taken me a few days to confirm what they said, but it's true. Alas, when I wrote it up, I seem to have confused the DUN1.2 upgrade with TweakDUN, and TweakDUN got the blame for our problems. My apologies; I'm not often that wrong.

DUN1.2 works well when it works, but, for reasons not clear to me, it can on some machines mess up your internal Windows 95 network. TweakDUN is a utility that lets you edit the Registry to change Dial-Up Networking parameters. The result among other things is that multiple Internet activities work better; you can find out more from NetPro NorthWest, whose site is worth visiting anyway. I've heard good things about TweakDUN, and it certainly does no harm. While I haven't yet tried to test how much good it does, I have the impression that it has helped a lot.

Incidentally, I managed to buy two copies of TweakDUN at $12.95 each. Naturally, a story goes with it.

Buying the first copy was a pain. There is a free shareware copy, but I generally forget to pay for shareware, so it's simpler to pay when I get it. Trying to pay for TweakDUN led me to the BuyDirect.com page; that one didn't want to accept my American Express card. It never said why. I checked the numb er and the expiration date, and got the same message: "There's something wrong." Eventually, I figured out that my card has no period after my middle initial, erased the one I had inserted, and downloaded my copy.

I did all this on Princess, which runs NT. Then I transferred the resulting td_12r.exe self-extracting installation file to Cyrus and ran it, getting the error message that "This application uses CTL3D32.DLL, which is not the correct version. This version of CTL3D32.DLL is designed only for Windows NT." I had no idea what program generated that message, except to note that whoever wrote it wasn't very clear on pronoun referents.

Mistakenly -- although I think understandably -- I concluded that since I had downloaded the file on an NT system, I had somehow got an NT version of it. That was when I fired up Communicator on Cyrus (which runs Windows 95) and bought the second copy of td_12r.exe.

Of course it gave the same error message. Ignoring that message produced the information tha t I didn't have many Visual Basic 5 run-time programs, but I could get them from http://www.simtel.net/pub/simtelnet/win95/dll/vb5run97.zip .

There's no way to cut and paste from that error message, so out came the logbook so I could hand-copy all that. The first time I fed that URL to Communicator, it did not work. I chopped it back to http://www.simtel.net/ , which got me to a place well worth going to: a collection of updates and freeware. Drilling down through its index got me nowhere, but eventually I found a search-engine form, entered vb5run97.zip, and voilà!

That g ave me a chance to test a newly installed update of WinZip. I copied vb5run97.zip into a work directory with Symantec's Commander 95, double-clicked on the filename, and up came both EXE and readme files. The readme file warned that installation would be tedious, requiring an installation, reboot, and another installation, but stay with it.

Double-clicking on the EXE file in Commander started the process, which went exactly as described. After this, double-clicking on td_12r.exe, ignoring the message about the wrong version of CTL3D32.DLL, and doggedly proceeding, I installed TweakDUN. WinZip and Commander make a good combination, and both are recommended.

TweakDUN does in fact offer to change various Registry entries, while making it easy to restore the defaults. As I mentioned, I haven't actually measured how much good making those changes has done, but a number of people I respect say it's worth doing; and certainly it has done no harm.

Incidentally, this machine is also running DUN1.2, a nd that hasn't done any harm either; but be careful.

I've been thinking about the big flap over Microsoft's requiring resellers to install Microsoft Internet Explorer (MSIE) 4 as a condition for getting Windows 95, and I think it's a tempest in a teapot.

If you want to be concerned over a Microsoft business practice, get angry over the Sun lawsuit about Microsoft "improvements" in Java that result in Java applications that work in MSIE4 but not in Navigator. The big attraction of Java is its universality, and Microsoft is doing its best to undermine that. I may be on Sun's side on this one.

The computer book of the month is Using Netscape Communicator 4 by Mark R. Brown with Tom Fronckowiak et al. (Que, ISBN 0-7897-0980-5). This book will tell you things about Communicator you didn't suspect you needed to know. It's complete, well organized, and well written. Incidentally, I use Communicator rather than MSIE mostly out of habit. Eric Pobirs, our intern, switched to MSIE4, which he claims has some outstanding features. So far, though, I haven't found as good a book about MSIE as this is about Communicator.

The book of the month is by Tim Powers, Earthquake Weather (Tor Books, ISBN 0-312-86163-X). Powers writes modern fantasy: imagine that the Fisher King of the West has been slain in modern-day Southern California, and Dionysius must be invoked to restore the king. This is a sequel to Tim's Expiration Date.

The runner-up game of the month is Interplay's Fallout, about the best "modern" role-playing game I've seen. It takes place in a dark and grim post-nuclear war society of survivors just barely hanging on. As a game it's pretty good, but I am very irritated by games that don't work well in Windows; you have to exit to DOS, and you may even need a boot disk to get this to run. I call that dark ages technology.

The game of the month is Microsoft's Close Combat: A Bridge Too Far. I've seen ads that imply that you can test your skil l against Montgomery's in his worst campaign, but that isn't true. This game uses the Microsoft Close Combat engine, and the scale is minor tactics down to the infantry squad; there are no real strategic decisions to make. It's like a real-time Steel Panthers II. I once swore never to play another real-time game again, but in fact the timing on this one is just right, neither too fast nor too slow. It's quite realistic, a good simulation of company-level tactical control that's also fun to play. It installs and runs in Windows 95 or NT without problems. Recommended.

And now I'm taking off to the annual Hackers' Conference, where I'm sure I'll learn a lot.


Where to Find

Close Combat: A Bridge Too Far.............about $44.95
Microsoft Corp.
Redmond, WA
Phone:    800-426-9400
Phone:    425-882-8080
Fax:      800-727-3351
Internet: http://www.microsoft.com

Fallout: A Post-Nuclear Adventure..........about $54.95
Interplay Productions
Irvine, CA
Phone:    800-468-3775
Phone:    714-553-6655
Fax:      714-252-2820
Internet: http://www.interplay.com

FreeSpace 1.0....................................$49.95
Mijenix Corp.
Madison, WI
Phone:    800-645-3649
Phone:    608-277-1981
Fax:      608-277-1971
Internet: http://www.mijenix.com

PartitionMagic 3.0...............................$69.95
PowerQuest Corp.
Orem, UT
Phone:    800-379-2566
Phone:    801-437-8900
Fax:      801-221-0149
Internet: http://www.powerquest.com

QEMM97...........................................$69.00
Quarterdeck Systems
Marina Del Rey, CA
Phone:    800-683-6696
Phone:    813-523-9700
Fax:      813-523-2391
Internet: http://www.quarterdeck.com

Vopt.............................................$49.00
Golden Bow Systems 
San Diego, CA
Phone:    800-284-3269
Phone:    619-298-9349
Fax:      619-298-9950
Internet: http://www.goldenbow.com/


Jerry Pournelle is a science fiction writer and BYTE's senior contributing editor. You can write to Jerry c/o BYTE, 29 Hartwell Ave., Lexington, MA 02173. Please include a self-addressed, stamped envelope and put your address on the letter as w ell as on the envelope. Due to the high volume of letters, Jerry cannot guarantee a personal reply. You can also contact him on the Internet or BIX at jerryp@bix.com . Visit Chaos Manor at http://home.earthlink.net/~jerryp/ .

Up to the Pournelle section contentsGo to next article: WEB EXCLUSIVE:  The Hesitation Blues
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network