"Locking" a File in RAM in OSX

Jump to First Reply
Posted:
in macOS edited January 2014
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)

Comments

  • Reply 1 of 15
    dfilerdfiler Posts: 3,420member
    Curious... just what kind of file are you wanting to put permanently in RAM?
     0Likes 0Dislikes 0Informatives
  • Reply 2 of 15
    randycat99randycat99 Posts: 1,919member
    I'm doing an experiment with VPC.
     0Likes 0Dislikes 0Informatives
  • Reply 3 of 15
    placeboplacebo Posts: 5,767member
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 4 of 15
    mattyjmattyj Posts: 898member
    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."
     0Likes 0Dislikes 0Informatives
  • Reply 5 of 15
    airslufairsluf Posts: 1,861member
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 6 of 15
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 7 of 15
    randycat99randycat99 Posts: 1,919member
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 8 of 15
    placeboplacebo Posts: 5,767member
    Quote:

    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.
     0Likes 0Dislikes 0Informatives
  • Reply 9 of 15
    airslufairsluf Posts: 1,861member
    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.

     0Likes 0Dislikes 0Informatives
  • Reply 10 of 15
    slugheadslughead Posts: 1,169member
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 11 of 15
    randycat99randycat99 Posts: 1,919member
    ...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.
     0Likes 0Dislikes 0Informatives
  • Reply 12 of 15
    ... 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.
     0Likes 0Dislikes 0Informatives
  • Reply 13 of 15
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 14 of 15
    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.
     0Likes 0Dislikes 0Informatives
  • Reply 15 of 15
    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.
     0Likes 0Dislikes 0Informatives
Sign In or Register to comment.