Specifications

Page B-3Read-Ahead and Write Buffering
SAVE MAX.DVR
RETURN
If you wish to disable or change the number of read-ahead blocks, simply use the
FIXLOG program to generate a new disk driver and if the disk driver is for the DSK:
device, don’t forget to use MONGEN and embed the new driver into the system monitor.
The generic driver Roadrunner SCSI disk driver (SCZRR.DVR) is setup for seven
read-ahead blocks.
B.3WRITE BUFFERING FOR SCSI-1 AND SCSI-2 DISK DRIVES
AMOS (and therefore every application written for AMOS) understands only 512 byte
disk blocks. Therefore, when a disk write request is made by a program, a single block
transfer is made to the disk drive. If the program then writes the next sequential block,
the system must wait the latency time of the drive (i.e., the time it takes the drive to
complete one revolution) before the next block can be written. Latency even on fast
SCSI-2 drives is around 7ms.
In order to speed up the write process, when write buffering is enabled, all writes to the
SCSI disk are first transferred into a buffer. If the write buffer becomes at least half full,
or around three quarters of a second passes with no reads, or if a preset "guaranteed
flush" timeout occurs, the SCZRR.DVR disk driver will begin scanning through the write
buffer, finding blocks that need to be written out to the drive. The algorithm used to flush
blocks out to the drive is able to find up to eight consecutive blocks and write them to
the disk drive as a single write command, therefore dramatically improving system
performance.
Another benefit of write buffering is it tends to eliminate duplicate disk writes, such as
bitmap updates during operations such as copying files and tape restores and prevents
head thrashing when reading through random access data files and writing a sequential
file out to the disk (as most report generation programs do).
B.3.1Potential Pitfalls
Obviously, there can be problems with write buffering, especially if either the system
crashes or is powered off while writes are pending in the write buffer. If either of these
two cases occur, all pending writes will be lost. Though this sounds like a major
problem, it can also happen if write buffering is not enabled. However, write buffering
increases the number of writes at risk.
To help reduce the possibility of data loss, certain safeguards have been put in place.
Writes are not buffered indefinitely; they are performed whenever the device is not
performing reads. Even if the drive is busy with read requests, the buffer is still
periodically flushed, based on a user definable "absolute flush time." Additionally, the
MONTST command automatically flushes the write buffer.
The primary write buffering risks are an errant software operation or a hardware failure
that causes a system crash.
PDI-00172-40, Rev. A05