OS X and RAM disks

Mikuro

Crotchety UI Nitpicker
Back in OS 9, I used RAM disks a lot for multimedia work. I gave up on even trying with OS X, since I barely had enough RAM to run the OS itself, let alone a disk. It'd just get paged right to VM, thus reducing speed.

But now I've upgraded my RAM to 1GB, which should be plenty.

I've tried both Esperance DV and Rambunctious, but with both tools, I find that it's reading from (and for some reason, writing to) the disk more often than not. What the heck?

It's not a matter of there not being enough RAM. I created a 190MB RAM disk when I had 500MB of free RAM (as reported by Activity Monitor). I copied a movie to it. No problem. Then I tried playing it, and....it kept reading from the disk. So it seems that despite the fact that my system has more RAM than it knows what to do with, my RAM disk is being stored in virtual memory. So again I ask: What the heck?!?

Is there any way to tell the OS to always keep a process in RAM, and never, ever page its memory to disk? I'd like to have OS X act like it has 768MB of RAM, and simply reserve the remaining 256MB for the RAM disk.

Am I asking too much? Is there any way to use RAM disks effectively for multimedia in OS X?
 
'... let alone a disk. ', ?

'But now I've upgraded my RAM to 1GB, which should be plenty', ? If you are making a definitive statement, it is incorrect.
If you are speculating - you are then hoping, dreaming, and / or under an illusion (maybe from the Steve Jobs reality distortion field). [Please read this comment with a sense of humor]

'I've tried ... Esperance DV and Rambunctious ... I find that it's reading from (... writing to) the disk more often than not. What the heck?', RAM Disks of System 9.2.2 and earlier do not operate as such under MacOS X.

'Is there any way to tell the OS to always keep a process in RAM', software wise - no. Hardware wise - yes, add the maximum amount of RAM your Mac mini can hold (which you indicated doing) ... and crossing your fingers.
'... and never, ever page its memory to disk?', no.

'Am I asking too much?', with respect to MacOS X and real efficient dynamic RAM allocation? - yes.

'Is there any way to use RAM disks effectively for multimedia in OS X?', no.

----

You could write a bash script (with 'system' as the owner, and 'wheel' as the group) containing ...

#!/bin/bash

sudo rm -rf /var/vm/*

... and have 'crontab' execute it daily - prior to when Apple's 'periodic daily' is performed, or multiple times during the day.
 
Yep, Just give up on ramdisks under OS X. They really don't buy you anything that the more advanced memory managment gives you. And by increasing the memory load by creating a ramdisk you acually are slowing things down more often than not.
 
Any OS with modern virtual memory management is almost by definition hampered by a RAM Disk rather then help by it.

Virtual memory management in the classic Mac OS was, to be charitable, primitive. In OS X virtual memory is a fact of life and very sophisticated. Take a look at this page on Activity Monitor to get a better understanding of how VM works in OS X 10.3 and 10.4.
 
Yeah, I know how VM works and how OS X caches data. While these are certainly Good Things in general, they are certainly not adequate as replacements for real RAM disks. The fact is that all OS X's advanced memory/caching features do nothing to help me in this case, and a RAM disk would do everything to help me. I could do this in OS 9, and it gave me results far superior to anything I can get in OS X. That's just sad. :( </mini-rant>

Oh well. Thanks for the answers, anyway.

I guess the only way to get what I want would be to create a kernel extension to manage the RAM disks in its own memory space, since kernel extensions live in "wired" RAM (meaning they are never paged out). But I guess nobody has done this — and I can see why, since kernel extensions are in principle disasters waiting to happen.

Nevertheless, I might try to create such a monster, risks be damned. ;)
 
'Virtual memory management in the classic Mac OS was, to be charitable, primitive.', well ...; however, most Mac'ers who knew better - simply turned it OFF, and knew the proper way to allocate RAM per application - for usability of the application, and minimum amount taken from the total RAM installed.
Because of this excellence in thought, by persons who knew how to create an OS (thus 'System 1.0 - 9.2.2), it was possible to create a RAM Disk which made (and still does on my IIci) one's Mac a speed deamon.

'... since kernel extensions are in principle disasters waiting to happen.', Kernel Extensions are MacOS X'es 'Control Panels' and / or 'Extensions' of System 9.2.2 and earlier. They can, and do, cause similar problems in MacOS X, as their counterparts did / do with System ...

'... what I want would be to create a kernel extension to manage the RAM disks in its own memory space, since kernel extensions live in "wired" RAM', which is (more to less) what a System 9.2.2 and earlier RAM Disk did / does.
 
If you have 1024 MB of RAM and dedicate 256 MB of RAM to a RAM-Disk, then your system only has 768 MB left, which in turn results in more VM-activity. Simple enough?
 
Back
Top