View Full Version : "Locking" a File in RAM in OSX
Randycat99
10-14-2004, 10:50 PM
Is there a way to do this, via some wicked looking command line thingy? I want to make it such that when a file is accessed, it is already mapped in real RAM, and stays there, regardless of useage. Is there a way to do this? Yeah, I guess this is much like a RAM disk situation, but I was curious if there was a way to invoke this directly on a "file", rather than setup a logical volume that actually resides in RAM. RAM-RAM-RAM, rammity, RAM-RAM... (had to use up my quota)
dfiler
10-15-2004, 07:42 AM
Curious... just what kind of file are you wanting to put permanently in RAM?
Randycat99
10-15-2004, 07:46 AM
I'm doing an experiment with VPC.
Placebo
10-15-2004, 08:16 AM
I'd love to do that, too, so if I got 8GBs of RAM, I could the entire UT2004 game into RAM, for sick load times.
mattyj
10-15-2004, 08:22 AM
I'd love to know that too, couldn't you then customise your ram to run certain things faster? Such as specific texture files for UT2004 etc...
On an off topic note, love that quote from Mr Dubya, one of my favourite's is "War is a dangerous place." :)
AirSluf
10-15-2004, 12:48 PM
Kickaha and Amorph couldn't moderate themselves out of a paper bag. Abdicate responsibility and succumb to idiocy. Two years of letting a member make personal attacks against others, then stepping aside when someone won't put up with it. Not only that but go ahead and shut down my posting priviledges but not the one making the attacks. Not even the common decency to abide by their warning (afer three days of absorbing personal attacks with no mods in sight), just shut my posting down and then say it might happen later if a certian line is crossed. Bullshit flag is flying, I won't abide by lying and coddling of liars who go off-site, create accounts differing in a single letter from my handle with the express purpose to decieve and then claim here that I did it. Everyone be warned, kim kap sol is a lying, deceitful poster.
Now I guess they should have banned me rather than just shut off posting priviledges, because kickaha and Amorph definitely aren't going to like being called to task when they thought they had it all ignored *cough* *cough* I mean under control. Just a couple o' tools.
Don't worry, as soon as my work resetting my posts is done I'll disappear forever.
Karl Kuehn
10-15-2004, 11:35 PM
If you have enough memory that everything can fit into memory, then it will stay there and the whole concept of a RAM disk is a waste of time. If you don't have enough memory... then you won't be able to do it (or will be crowding other active applications and will cause the system to slow-down due to swap anyways).
Unless you are writing to a file a lot (little writes), and you don't actually care about the changes (so they can go poof), the only benefit to a RAM-disk-like setup would be that it caches everything into memory. To get that benefit you could simply write a small program that would go over every file and read it. That would cause it to be brought into memory, and unless something else pushes it out, it will simply remain there, dormant. Even if the reading program terminates.
Now, this will not really help you with 3d games, as what they create in memory is not exactly what is on the HD. Instead they build structures in memory that are described in compressed files on the HD. A RAM-disk will never help with these programs... they are already do that sort of work themselves.
Randycat99
10-17-2004, 04:51 AM
There's got to be some command to do this, if OSX can hardwire its collection of shared resources and such... The point of this topic was not really to discuss if one really needs this knowledge or not, but does the command exist.
Placebo
10-17-2004, 09:23 AM
Originally posted by mattyj
I'd love to know that too, couldn't you then customise your ram to run certain things faster? Such as specific texture files for UT2004 etc...
On an off topic note, love that quote from Mr Dubya, one of my favourite's is "War is a dangerous place." :)
Hehe...I like the entrepreneur one because it demonstrates both arrogance and cultural ignorance at the same time.
AirSluf
10-17-2004, 01:43 PM
Kickaha and Amorph couldn't moderate themselves out of a paper bag. Abdicate responsibility and succumb to idiocy. Two years of letting a member make personal attacks against others, then stepping aside when someone won't put up with it. Not only that but go ahead and shut down my posting priviledges but not the one making the attacks. Not even the common decency to abide by their warning (afer three days of absorbing personal attacks with no mods in sight), just shut my posting down and then say it might happen later if a certian line is crossed. Bullshit flag is flying, I won't abide by lying and coddling of liars who go off-site, create accounts differing in a single letter from my handle with the express purpose to decieve and then claim here that I did it. Everyone be warned, kim kap sol is a lying, deceitful poster.
Now I guess they should have banned me rather than just shut off posting priviledges, because kickaha and Amorph definitely aren't going to like being called to task when they thought they had it all ignored *cough* *cough* I mean under control. Just a couple o' tools.
Don't worry, as soon as my work resetting my posts is done I'll disappear forever.
slughead
10-17-2004, 02:09 PM
I don't see the point, outside of security.
When the computer shuts down, no more file.
Outside of that, it'd only save on load times for games and such. It'd probably slow down the game (having less RAM at its disposal) more than it would speed it up.
... unless you had 8 gigs or something.
Randycat99
10-17-2004, 09:20 PM
...to put a certain cache in RAM that OSX is seemingly not smart enough to (or cannot be expected to determine to) keep in memory? It need not be a huge RAM allotment, either- just a wisely directed one.
Karl Kuehn
10-17-2004, 10:04 PM
... except that you are trying to out-think the virtual memory system which is already doing this job. Things will not fall out of memory unless something more active/needed pushes it out. In that case the chances are 99% that you will get better performance by swapping it out.
With the exception of OS code that deals with the kernel, VM, and driver systems, there is almost nothing that will benefit, and those things are best marked at compile time... and I don't think we have any OS engineers on this list.
Randycat99
10-17-2004, 10:20 PM
That's the theory, at least, and one hopes the real operation follows it fairly closely. However, it is a bit overbearing to assume the system they have implemented works in utter perfection, and there is absolutely no area a mere human could make a local improvement for a specific condition. Maybe the proposed technique works, maybe it is a wash as a consequence of the system doing what it was intended to do. You never know for sure until you try it out. At least it is a more interesting proposition than always resorting to the default fallback- OSX handles that, you don't need to worry about it, there is nothing you can do to tweak performance. That is the fundamental difference in the focus of this topic- the difference between asking, "how can I do this?" vs. "how much good would this do?" When it comes to running WinXP in VPC within OSX, I'd say there is a good, but small chance, some creative tweaking lies in wait to be revealed.
Karl Kuehn
10-17-2004, 11:02 PM
The virtual memory system MacOS X uses is the latest generation in the development of the one for the *nix line. And time and time again it has proven that this (fairly simple) system is the best solution for the fast majority of all cases. It is the same system that handles large Oracle databases, and it handles video productions systems. Over and over it proves itself because you can rarely beat the simple axiom: if it is in use, keep it in memory. Only take things out of memory when something else needs it more.
As long as you have enough memory, nothing will drop out. It is that simple.
If you don't have enough memory then the stuff you are using most should be the stuff in memory. The chances that you, the user, are going to be able to predict what seldom-used file is suddenly going to become needed is close to 0.
And as to your idea of answering the question... it is entirely appropriate to point out that this is not a route to a valid solution. Purposing to put blinders on peoples' thinking so that they can only answer a narrow question on a subject the asker doesn't really understand is a counterproductive practice.
Randycat99
10-17-2004, 11:18 PM
Yes, master... Discussions are easy when you presume default omnipotence over others. It may or may not be the case. However, it won't likely incur a rush of people to listen to you unconditionally.
Let's just say the points you bring up are certainly valid, and I was well aware of OSX's comprehensive abilities prior to your posts, yet, I have not given up the notion of tweaking and experimenting with stuff. It's my own time to use as I see fit, whether it ends up being constructive or merely educational. I appreciate your inputs on the topic, otherwise.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.