# Background and Overview

This section is an overview of how to create a cdrom.image file of your title using the layout tool optimized for clustering and the Catapult file for rapid startup.

You learn about:

- Layout tool background information
- Process for using the layout tool

Note: Feel free to skip the background information first if you're mostly interested in the process.

## Layout Tool Background Information

The layout tool, which is provided on the 3DO Portfolio CD-ROM, takes all files in a folder and creates one CD-ROM image file. In the process, it places one or more avatars (instances) of the root, label, and directory in the image.

The current version of the layout tool allows optimized layout. First you collect information about your title using a simple image, then the layout tool uses that information for layout. The current layout tool also contains the Catapult feature which enables your CD-ROM to be started up much more quickly than was possible in earlier releases.

### Nonoptimized Layout

The original layout uses a "first seen, first placed" algorithm. Files are "seen" in alphabetical order within each directory; subdirectories are seen and placed recursively as they're encountered.

This algorithm leads to delays during certain stages of a title's startup. For example, a program's sound (.aiff) files frequently require the loading of a DSP instrument (.dsp) template file. Because the .aiff and .dsp files are stored in different directories, they're a fair distance apart on the CD-ROM, and the drive spends a lot of time moving the read head back and forth between different areas of the disc.

### Layout Using the Cluster Optimizer

The current layout tool with its cluster optimizer locates files in clusters according to when they are used, not according to their position in the file system. If files from different directories are accessed one right after the other, they usually end up in adjacent sections of the CD-ROM. This greatly reduces head-seek time. Since files that are accessed in sequential time order are often laid out in sequential physical position, several files can be read in sequence with only one head seek.

The optimizer also places additional avatars (copies) of frequently-accessed files in several different locations on the disc. Small, frequently used files may be replicated up to 7 times). Large or infrequently used files may not be replicated at all.

The amount of avatar duplication depends on the amount of otherwise unused space in your file system. If your title has so much data that it almost fills a 640 MB CD-ROM, very little space is available for cluster optimization and avatar duplication. If your application uses only a few hundred megabytes, there is plenty of room for avatar duplication. This can improve performance. It also enables your application to run even if one or more avatar of critical files is not available because of scratching or other damage to the CD-ROM.

The clustering optimizer has some significant limitations. It is fairly common for an application to read pieces out of several different files in alternation. For example, when opening an audio .aiff file, the audio folio usually reads the first block of the .aiff file, then opens and reads the contents of a .dsp instrument file the .aiff file points to, and then reads the remainder of the .aiff file. The cluster optimizer can reduce the cost of the head seeks that take place when the drive seeks back and forth between the .aiff and .dsp files, but it cannot eliminate them. A similar problem arises whenever a program reads data from two or more files in parallel.

A further limitation of the clustering optimizer involves directories. Directories cannot actually be placed within clusters, because the size of a directory cannot be determined accurately until the placement (and number of avatars) of every file within that directory have been finalized. During a cluster optimization, directories are placed in small gaps between clusters. Accessing a directory at runtime (if the directory's contents are not currently in the directory cache) usually requires two head-seeks: one to the directory and one to the file that has just been opened. Clustering can reduce the cost of these directory-related seeks, but cannot eliminate them.

### Catapult

Catapult is a feature recently added to the optimized layout tool. With the Catapult feature, the layout tool collects the CD-ROM data that your application needs at startup time (programs, data files, folios, directories, etc.) into a single area of the disc, in exactly the order needed. As a result, the startup process requires very few head-seeks. Proper Catapult optimization of your title can reduce its startup time significantly.

Catapult's operation takes place at the file system/driver interface. Since you can use Catapult without making any changes to your programs or data, you should prepare one optimized image using Catapult, one optimized image without Catapult, and complare. The actual speedup varies greatly depending on the title itself. level.

## Optimized Layout Process Overview

To use the clustering optimizer, you must perform the layout process twice and collect access information in between. This results in the following steps, which are described in the remainder of this chapter:

- Perform your first layout process which results in a simple, nonoptimized cdrom.image file.

- Test your title.

- Create the base image for optimized layout. Use this image to exercise your title and collect access information using the 3DO Debugger's ability to create a CD_Access.log file which records all of the reads issued to the cdrom.image file during testing.

- Perform a second layout process during which the layout tool uses information from the CD_Access.log file to group files into clusters based on the actual patterns of use. This optimized cdrom.image file can then be burned onto a CD-ROM disc and tested.