VOGONS


First post, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

https://devblogs.microsoft.com/oldnewthing/20 … 24-00/?p=102915

MS-DOS 2.0 contained a disk read cache, but not a disk write cache. Disk read caches are important because they avoid having to […]
Show full quote

MS-DOS 2.0 contained a disk read cache, but not a disk write cache. Disk read caches are important because they avoid having to re-read data from the disk. And you can invalidate the read cache when the volume is unmounted.

But wait, you don’t unmount floppy drives. You just take them out.

IBM PC floppy disk drives of this era did not have lockable doors. You could open the drive door and yank the floppy disk at any time. The specification had provisions for reporting whether the floppy drive door was open, but IBM didn’t implement that part of the specification because it saved them a NAND gate. Hardware vendors will do anything to save a penny.

But that read cache is crucial for performance. Without it, you have to start from scratch at every I/O operation, re-reading the volume table of contents, finding the directory entries, searching the block allocation tables looking for the next free cluster… And a floppy disk is not exactly the fastest storage medium out there, so all of these operations cost seconds of performance.

To avoid having to abandon the cache entire, the MS-DOS developers did some benchmarking: How fast can a human being swap floppies in an IBM PC floppy drive?

Mark Zbikowski led the MS-DOS 2.0 project, and he sat down with a stopwatch while Aaron Reynolds and Chris Peters tried to swap floppy disks on an IBM PC as fast as they could.

They couldn’t do it under two seconds.

So the MS-DOS cache validity was set to two seconds. If two disk accesses occurred within two seconds of each other, the second one would assume that the cached values were still good.

I don’t know if the modern two-second cache flush policy is a direct descendant of this original office competition, but I like to think there’s some connection.

How To Ask Questions The Smart Way
Make your games work offline

Reply 1 of 4, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

I wonder if its related to the fact that dos time stamps are 2 second granuality rather than 1 second granuality...

nothing like shoving 17 bits of information into 16! something gotta give, why not a second?

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 2 of 4, by krcroft

User metadata
Rank Oldbie
Rank
Oldbie

Crazy.. that's really unfortunate they couldn't programmatically invalidate (or trust) the state of the floppy drive; and thus has to invalidate prior reads once they aged past 2-seconds.

Then again, at roughly 120KB/s peak read speed from a 1.44MB floppy drive, two seconds of data would need about 256KB of read-cache; which perhaps was generous back in the days when 1, 2, and 4MB was typical in machines.

But once people had 8MB and 16MB, it sure would have been nice if DOS was able to trust the state of the floppy drive and thus fully read-cache its content, because access times were so brutally slow.

I suppose by that time floppies had already moved to an archival role (installs or backups), as opposed to being the active runtime medium for software; and smartdrv was offering large read cache and write buffering for HDDs.

Reply 3 of 4, by Zup

User metadata
Rank Oldbie
Rank
Oldbie

FDDs have a "disk change" or "disk ready" signal. Why don't keep the cache valid until the status changed?

I have traveled across the universe and through the years to find Her.
Sometimes going all the way is just a start...

I'm selling some stuff!

Reply 4 of 4, by krcroft

User metadata
Rank Oldbie
Rank
Oldbie
Zup wrote:

FDDs have a "disk change" or "disk ready" signal. Why don't keep the cache valid until the status changed?

See OP.. IBM saved money by not implementing the hardware signal, so MSDOS was programmed assuming it could not trust the content on floppies beyond 2 seconds.. (the maximum humanly-possible rate at which one could repeatedly swap floppies 😢 🤣 )