Skip to main content
Home Documents Software Guides Macintosh Disk Cache Fix
Macintosh Disk Cache Fix

Macintosh Disk Cache Fix

Filenamemacintosh-disk-cache-fix.txt
Size0.01 MB
Downloads3
Contents
Date: Wed, 10 Aug 1994 09:11:50 -0400 (EDT) From: Edwin Chee <echee@isnet.is.wfu.edu> Subject: Macintosh Disk Cache fix -- 25 times speedup Below is an interesting thread on making the Macintosh Disk Cache much more efficient with a simple hack. Stuart Cheshire has written a simple, useful system extension that he is distributing as freeware. I would welcome any discussion on his idea particularly regarding data integrity, reliability, stability, and efficiency. Also, does anyone have any ideas on how to improve on his program? If his modification to the write cache is really as good as I suspect, I would hope that Apple would include this in their next version of the Mac OS. Please forward replies to echee@isnet.is.wfu.edu and I will compile a complete record of this thread and distribute it at a later date. ================================================================== Here's a message I posted on Thursday to the Nuntius mailing list: ----------------------------------------------------------------- Has anyone else noticed that at the end of extracting a binary in Nuntius the disk light comes on, stays on for a few seconds, and freezes the Mac for that duration? It gets unbearable if you have a large disk cache, but even with only a 256K cache it can freeze the Mac for up to 5 seconds. This is not the fault of Nuntius -- many other programs like BinHex decoders, uudecoders, archive expanders etc. seem to suffer the same problem. This really annoys me. One of the good features of Nuntius is the way it lets you continue working while it is doing other things in the background, so having it freeze like this is particularly galling. The problem is that Nuntius (and other programs) write their data to disk in chunks (say 4K each) and the Mac caches the blocks in its disk cache. When the file is closed the data is finally written to disk, and this is what causes the big freeze up. It would be much better if the data were written continually to disk, instead of in one big burst at the end. Yesterday morning I wrote a little INIT which sets the File Manager "don't cache" bit for disk writes of 1K or more. It does this by installing the following patch on the _Write system call: tst.w IOParam.ioRefNum(a0) ; Is this a file write? bmi.s @sys_write cmp.l #1024, IOParam.ioReqCount(a0); Is it at leask 1K? blo.s @sys_write ori.w #0x20, IOParam.ioPosMode(a0) ; Set "Don't cache" bit extern sys_write:jmp 0x12345678 ; Resume the system call One surprising artifact of this is that it not only amortises the disk time over all the writes, but it also makes it 25 times faster. What? Yes, it's true. I set my disk cache to 768K, and wrote a test program which wrote to a file in 32 blocks of 16K each, making a total of 512K. Without the INIT, the writes took almost no time, but the Close call took 11 seconds, av…

Showing first 3,000 characters of 6,281 total. Open the full document →