How a CD-Rom Works and How to Make it Faster

by Graham Wing - PC Improvements

How do they work?

One of the things that seems to be promoted the most when you look at new computers are(sic) the "blazing fast" CD-ROM drives. The chances are that if you have one of the scorchers, you have been disappointed with its performance. I originally had a 12x CD-ROM and bought a 24x CD-ROM to replace it and it is no where near 2x's as fast as the old one. What is the deal with that?

There are two factors involved in a CD-ROM drive's performance. The first is the DATA TRANSFER RATE of the drive. This parameter is widely touted by manufacturers and has been given a good deal of press. We've gone from single speed drives with a data transfer rate of 150 Kb/s to 32x drives at 4800 Kb/s (the 32x means that it is 32 times faster than 150 Kb/s e.g. 150x32=4800). Speeding up the data transfer rate of a drive is a relatively easy thing to do. A drive's manufacturer designs a drive that simply spins the CD-ROM faster. That's why there has been such a big increase in the data transfer rate of drives in the past few years. It's just not that big a feat to design a drive that spins faster.

The other factor affecting a CD-ROM drives performance is ACCESS TIME, also called seek time. This is the average time it takes to reposition a drive's read head to a new location and start reading data. Access time has improved relatively little in the course of developing new drives with faster and faster data transfer rats. It's not that the drive manufacturers wouldn't like to greatly increase access time, it's just not an easy thing to do. The hard fact of the matter is you're up against the laws of physics. Because drive access time hasn't improved all that much, its role in drive performance has often been downplayed. You'll hear someone brag about their new 32x drive, but these same people probably don't know the access time of this "speed demon". You can be sure, however, that it is slow. It's interesting to contrast this situation with that of hard drives. With hard drives, the performance criteria people talk about is access time! It's the data transfer rate they have no idea about. Even with 32x CD-ROM drives, the average time it takes to reposition a drive's read head to a new location and start reading data is at least 100 milliseconds. Compare that with the under 10 millisecond access times of today's hard drives. Access time is the other piece of the CD-ROM drive performance puzzle.

Data on a CD-ROM is recorded in equal length sectors on a single spiral track that starts at the inner edge of the disc and finishes at the outer edge. This track is on the order of .6 microns wide, with a turn spacing of 1.6 microns. A micron, if you don't happen to remember, is equal to a millionth of a meter. A human hair is about 100 microns in diameter. A CD-ROM has a track density of about 16,000 turns per inch if you measured across the disc. If you stretched this track out into a straight line it would measure over 3 miles in length!

A drive's read head assembly consists of a solid state laser, lenses, a beam splitting mirror and a photo diode to detect the reflected light. In relative terms this assembly is massive. The magnetic heads used in hard disk drives are tiny by comparison.

CD-ROM drives lower than about 12x, utilize a principle called constant linear velocity (CLV). With CLV the data must pass across the read head at the same speed, no matter where on the disc it is positioned. Because data sectors on the outer and inner edges are the same length, the rotational speed of the disc must constantly change as the read head changes position. If it didn't, the bits on the outer edge of the disk would pass by almost 3 times faster than those near the center.

CD-ROM drives of 12x or higher, give up CLV operation to improve access times. But this means that for a 12x drive, 12x is really the top speed. This rated speed is only attainable on the outermost tracks of your CD-ROM. Depending on where the read head is positioned, the data transfer rate will be lower than 12x. In fact, since data starts at the inner edge of a CD-ROM, it almost always will have a data transfer rate slower than its rated speed! Your actual data transfer rate may be as much as half the speed that it's rated for. This means your 20x drive may only really transfer data at 10x!

So to summarize the mechanical problem we face, we must precisely follow a very narrow track of data using a relatively massive laser assembly. At the same time (for drives rated less than 12x), we must constantly vary the rotational speed of the disc so the data passes at a constant linear speed when we move the read head. And we want to be able to reposition this read head and be ready to access new data as quickly as possible.

As you can imagine, it's just not possible to do this very quickly. The more mass something has, the slower you can whip it around. If in addition, you have to position it with sub-micron accuracy, this takes more time. And if you also have to readjust to a new rotational speed every time you move, you need more time still.

This is why CD-ROM access times are slow and it's not going to change any time soon. Although 24x and 32x speed drives have increased the raw data rate (by increasing the rotational speed), access times have not dropped proportionally.

How do you make them faster?

After reading about a program called CD-Quick Cache, I contacted the creator and he sent me a copy of the program to test. It works great.

The key to speeding up CD-ROM performance is to minimize the number of times we reposition the read head. Because every time we move this head, we waste time. The way to reduce head movement is to use a cache like CD-Quick Cache. Once data is read into the cache, it will be accessed from RAM (or disk) instead of the CD. If we can anticipate data to read when we are positioned at this data, we can minimize head movement. CD-Quick Cache uses advanced caching techniques to help ensure that the data you need most will be found in the cache.

Microsoft recognized the importance of a CD-ROM cache and Windows 95/98 does CD-ROM caching on its own, but there's certainly room for improvement here. The cache that comes with Windows 95/98 has a maximum size of a little over 1MB. That's it. Although this might be large enough for some applications, others will certainly benefit by a larger cache. If you have enough memory, CD-Quick Cache can set a RAM cache as large as 32MB. If disk space is available, the cache can be as large as 256MB! And unlike the Windows 95/98 CD-ROM cache, CD-Quick Cache's cache is persistent. It remembers your CD-ROM data from CD to CD and also between sessions!

Another difference is the Windows 95/98 cache uses fixed read ahead buffering. You can select the amount of read ahead (or even turn it off), but once its set, it stays that way. Some applications will benefit by doing read ahead while others will suffer for it. The only way to optimize operation for a wide variety of applications is by using dynamic read ahead buffering as CD-Quick Cache does.

When CD-Quick Cache is loaded on your computer, every time you read data from your CD-ROM drive CD-Quick Cache also saves it to RAM or your (comparatively) faster hard drive. The next time this same data is needed, CD-Quick Cache intercepts the request and retrieves the data from its cache. The time to access and move a block of CD-ROM data from RAM memory is microseconds. Even if you use your hard drive for cache storage, access time is measured in several milliseconds.

It's not enough to just store CD-ROM data in a fast cache. It's very important to manage this data in an intelligent manner. The reason caching works is due to probability. It's likely that you'll need the data you've just read some time in the future. Most applications work this way, and as mentioned, it's the basis for caching. It's certainly possible to write a program that reads a CD-ROM's data only once from start to finish, but it's not at all likely that any useful application would ever work this way.

After the amount of data read is equal to the size of CD-Quick Cache's cache, some data in the cache must be discarded to make room for new data. CD-Quick Cache uses a "Least Recently Used" (LRU) algorithm when it's time to decide which data gets overwritten. As you might expect from the name, with LRU the oldest data gets replaced first. CD-Quick Cache's LRU scheme is very effective at keeping the data you'll most likely want in the cache rather than on the CD.

If data is requested that's not in the cache, it's important that CD-Quick Cache discover this quickly. CD-Quick Cache uses a hash table to quickly locate data stored in its cache (or not)

An additional technique used by some caching software is sector read ahead buffering. This system is also based on probability. When reading data from a CD-ROM it's most likely that the next block of data you'll want is the block following the one you've just read. This certainly won't always be the case. We're just going with the odds here, but the odds are right often enough.

It's important here to note that you can have a cache that does not do read ahead buffering. This is a separate feature from the cache itself. If implemented properly, it's another way to increase performance.

When a cache does read ahead buffering, it reads more data than you've requested. The requested block of data is read from the CD-ROM, but so is the next sector or two (or three). The requested data is passed to the application that requested it, and it's also stored in the cache along with the read ahead data. When and if your application wants data from these additional sectors, it's available in the cache.

So, doing read ahead buffering is a good thing right? Well that all depends. If we're reading data sequentially, it's another trick we can use to boost performance. But what if we're reading data from the CD randomly? Reading a block, jumping to a new location, reading some more, moving again, reading again, etc. If we always read ahead the same amount, a cache can quickly fill up with data you'll never want. This can greatly reduce your effective cache size. If two out of every three reads is wasted, you're using a cache that's actually only one third the physical size. For example, say you've got a 1.5 Mb cache set. If you're reading randomly and you read two additional sectors for each sector read, your working cache size is really only 512K. You're wasting 1 Mb of memory! CD-Quick Cache does do read ahead buffering, but in an intelligent manner. CD-Quick Cache's read ahead is adaptive. It constantly monitors the actual pattern of your application's reads and then dynamically adjusts the amount to read ahead. So if data is being read sequentially (reading ahead is a good thing), CD-Quick Cache reads ahead. If data is being read randomly (reading ahead is a very bad thing), CD-Quick Cache doesn't read ahead.

The software actually uses fuzzy logic to determine the degree of randomness and set the amount to read ahead. This dynamic read ahead insures CD-Quick Cache will make the very best use of your precious RAM (or disk space).

From phone directories to games, more and more CD-ROM applications are requiring multiple CD sets. To deal with this situation, CD-Quick Cache has the ability to track up to 256 different CD-ROM titles. It does this by computing a unique signature for each CD-ROM from a combination of its Volume Name and Serial Number. This allows it to remember data when you change discs. So, if you change CDs and then go back to an earlier one, your data will still be able to be retrieved from the cache. Volume titles are tracked on a most recently used basis, so it is the last 256 CD-ROMs that are tracked.

In addition, if you use your hard drive for cache storage, CD-Quick Cache has the ability to save your cached data and volume information between sessions. This means you can shut down your computer, come back to it days later, insert the same CD-ROM that you used a few CD-ROMs back, and have it's data instantly!

My Own Experience

A lot of the information from this article has been collected in many places, but how did I like it? To be honest, with some of my CDs, I didn't notice any improvements. This is probably because there weren't very many reads needed. I do notice an incredible difference when I use PrintMaster Platinum.

As with most desktop publishing suites, there are so many graphics, that you get half a dozen CDs that contain all of these graphics. You can browse a graphics catalog and then you are prompted to insert a CD. I found that when I had CD-Quick Cache running, this process was unbelievably fast, compared to the way it was before. I could browse the graphics catalog very quickly. My wife had been complaining that it would take so long for each new page of graphics to show up, but not anymore.


Article from computerjournal.com

Article Click here to return to list of articles