Article 1715 of comp.sys.amiga: Path: mcdsun!noao!hao!ames!lll-lcc!well!perry From: perry@well.UUCP (Perry S. Kivolowitz) Newsgroups: comp.sys.amiga Subject: Overhead And Implementation Notes of ASDG RRD Keywords: in response to Kim's note Message-ID: <2482@well.UUCP> Date: 26 Jan 87 18:54:14 GMT Lines: 107 Some poeple have asked for more information about the ASDG Recoverable Ram Disk internals, specifically how implementation details affect memory usage and performance. First, the ASDG RRD is a track disk driver. This differs considerable from the implementation of RAM:. See Figure 1 for a quick block diagram. Floppies and VD0: Exec Proper <---------> File Handler <---------> TrackDisk Device RAM: Exec Proper <---------> Ram Handler (Figure 1) This fundemental difference between the implementation of VD0: and RAM: leads to many differences in other ways: (1) VD0: is totally compatible with AmigaDOS since it is dependent upon the very same FileHandler to implement a file system as the floppies use. Because the RamHandler has to provide all of the outward function- ality of a FileHandler, this functionality was reimplemented in the RamHandler. Unfortunately, there are still some incompatibilit- ies between RamHandler and FileHandler which manifest themselves as bugs such as the 1.2 ``can't delete a directory from the workbench bug.'' (2) Speed of RAM: to RAM: transfers are much faster than VD0: to VD0: since the ram: device simply passes blocks around inside itself while vd0: must pass blocks to the filehandler and then accept the blocks from the filehandler in return. (3) RAM: can sometimes use space more efficiently (and sometime less). This is what Kim@Amdahl brought up. He said that for 60 files and some number of directories, 128K of memory seemed to disappear as ``overhead.'' The ASDG RRD allocates a track at a time. If the AmigaDOS FileHand- ler says ``allocate exactly 1 sector per track'' a full 8K will be allocated. This space is *not* lost however since the FileHandler ultimately gets around to allocating other sectors per track. Remember, asdg.vdisk.device does make decisions over where to put data on the logical disk, it is only responsible for making sure a block request made by the FileHandler is satisfied. In Kim's case, AmigaDOS has obviously made some choices about where to put blocks which resulted in tracks not being completely consum- ed before other tracks were allocated. This apparent ``overhead'' disappears as the RRD becomes full and tracks become used completely. What follows is a more complete study of memory overhead. A completely empty vd0: 6K used by driver code. 4K used by AmigaDOS to deal with driver. 8K used by root track (only preallocated track). 7K used by miscellaneous data. For a total of 25K of memory gone just to give you an empty disk. RAM: immediately after initialization consumes 9K. Of this, the 8K for the root track is not overhead since you're going to need the space anyway. This leaves 8K above the RAM: device in overhead. Each track consumes: 142 bytes of overhead. This includes a checksum for every sec- tor and some magic cookies I need. My studies indicate the AmigaDOS makes much better block assign- ments for small files than large ones. That is: an 8K files will cause 8K worth of memory to be used by VD0: while a 55K file will cause 65K worth of memory to be used assuming you're copying onto a completely empty file system. Note (again) that you will get full use out of the ``missing'' 10K. Later, when FileHandler puts other things on the mostly empty tracks it's allocated. On the whole, while VD0: may use more memory early on, the memory utilzation of VD0: as the device becomes full approaches the opt- imal amount needed to store the data itself. A while back when Fred Fish posted Rick Spanbauer's Disk Benchmark res- ults, the write speed on VD0: was slower than the read speed. This is because during writes a checksum of each sector written is taken. The checksum for each sector is useful in finding single byte or bit errors which would otherwize cause you to use corrupted data without knowing it. And then again, most operations on the ram disk are reads anyway (with no performance degradation). I might add that on a 68010 Amiga, the performance was about 5Kbytes per second faster than Fred's results. I guess this is the influence of tight loops (very tight, 2 instructions) running faster. Perry S. Kivolowitz ASDG Incorporated (201) 540-9670