MadSci Network: Computer Science

Re: How do disk compression utilities work?

Area: Computer Science
Posted By: Steve Laybourn, Frustrated PERL/CGI Programmer, Insurance Internet Solutions
Date: Wed Apr 2 21:52:45 1997
Message ID: 859387106.Cs

OK, the basic theory of disk compression (as I understand it) first arose when it was noticed that you could take a string of binary digits and compress them with an algorithm alternating between zeroes and ones. In short, a string like:


                        Q         M         e         c         h
which in binary is: 0101 0001/0100 1101/0110 0101/0110 0011/0110 0100

would interpret as: 111131112211122111123212212
Each number in the bottom last string would alternately be the number of ones or zeroes to fill in, in a flip-flop fashion.
so: 0101 --> 1111
0001 --> 31
0100 --> 112 
1101 --> 211 etc.. as in the compressed string.

This doesn't work all that well for text fields, I know, but this is the very sort of thing that the .PCX and .GIF graphic formats are built upon. You compress data by saying "so many of this color pixel in a run", rather than "this pixel is this color, the next pixel is this color, the next pixel is this color", ad nauseum... you see the point?

It is on a similar sort of arrangement that disk compression is based. (Though this is like saying that this Model A engine I just showed you above comes anywhere close to the F22s actually flying up above us!)

Disk compression is cool, yes! It belongs in a technician's toolkit! But there are limits and dangers to it...

The main danger is if the routine encoding/decoding the compressed data gets damaged. Well, if it was running your hard drive, I hope you have a bootup disk on hand with the routine on it so everything can be replaced and rebooted. Otherwise, things gets worse... Data recovery is not a problem, but decoding the recovered data could very well be a major problem...this is the main disadvantage I can think of of compressed drives...

There are many good compressed drive systems and softwares. On the whole, in this day and age with faster processing speed requirements, it seems to work better if you DON'T use them! Rather, compress files within a drive (I use WinZip, it's the best!). Decoding compressed data eats up a lot of compute cycles...think of how slow your computer would run Notsafe Alligator(sic) if it had to decompress all the routines to RAM before trying to run'd have time to send out for pizza before it was done!

This is probably not at all what you wanted to hear, but forewarned is forearmed! (Hmmm, four arms WOULD be an advantage at a keyboard...Never mind.)

I hope this has been of some help to you. The ZIP Bible from Abacus Press is a very good primer on the real details of compression theory...

Be seeing you!
Steve Laybourn
Site Programmer

Current Queue | Current Queue for Computer Science | Computer Science archives

Return to the MadSci Network

MadSci Home | Information | Search | Random Knowledge Generator | MadSci Archives | Mad Library | MAD Labs | MAD FAQs | Ask a ? | Join Us! | Help Support MadSci

MadSci Network
© 1997, Washington University Medical School