Files can be accessed on RAM disks (or any media, for that matter) in a variety of ways. "Chunk Size" refers to the size of data accessed from the RAM disk. The smallest possible chunk size is 512 bytes, or 1/2 K. The largest theoretical chunk size is the size of the whole RAM disk!
Sometimes the system chooses what the chunk size should be, and sometime the application software decides. For example, if the application software tries to read a file one character at a time, the system reads 512 bytes and remembers what's there when the application reads the next character.
On the other hand, an application can choose to read large chunks, and these large chunk sizes are essentially the chunk sizes seen by the RAM disk driver.
Typically, larger chunk sizes lead to higher throughput, since most of the time can be spent actually reading the file instead of figuring out where on the RAM disk the file is, and other overhead tasks.
RAM disks are a convenient way to achieve high performance in many applications. Hard drive accesses are hundreds of times slower than memory accesses. RAM disks set aside an amount of memory that the system can then use as a "normal" hard drive, floppy drive, or any other storage device -- except that they're much faster.
Typical advantages of RAM disks include:
Typical disadvantages of RAM disks include:
Virtual Memory ("VM") refers to how the MacOS can use hard drive space to simulate extra memory. If the OS tries to access a memory address that's currently not really in RAM, it needs to load it from the hard drive, then continue accessing it as usual. Since hard drive accesses are much slower than RAM accesses (that's why a RAM disk is so interesting, after all) those occasional accesses when a "page fault" occurs are much slower than accesses where everything is already in physical RAM.
An interesting dilemma arises when you have virtual memory enabled while using a RAM disk.
Should the RAM disk honor VM and allow itself to be paged out to a hard drive? Or should it force its contents to stay resident in RAM?
If it forces itself to stay resident in RAM (ie, does not honor VM), that provides the fastest performance — for the RAM disk itself. But it ensures that other programs will be paged to disk more frequently. So overall system performance will likely suffer.
We had a tough decision when we faced this issue. The answer we came to was this: if the user has turned on virtual memory, then clearly the user accepts the performance-for-memory penalty inherent in using virtual memory. That's why ramBunctious honors VM: because it's more clearly what the user wants.
Of course, ramBunctious's performance is maximized when virtual memory is turned off. The people who have typically found ramBunctious RAM disks to be the most useful have been people with lots of RAM available; this leads us to recommend that for best ramBunctious performance, virtual memory should be turned off.