Slashdot Mirror


How To Use a Terabyte of RAM

Spuddly writes with links to Daniel Philips and his work on the Ramback patch, and an analysis of it by Jonathan Corbet up on LWN. The experimental new design for Linux's virtual memory system would turn a large amount of system RAM into a fast RAM disk with automatic sync to magnetic media. We haven't yet reached a point where systems, even high-end boxes, come with a terabyte of installed memory, but perhaps it's not too soon to start thinking about how to handle that much memory.

19 of 424 comments (clear)

  1. 1 TB of memory... by Digi-John · · Score: 5, Funny

    Finally, I'll have enough space to run Firefox, OpenOffice, and Eclipse *all at the same time*! As long as I don't leave Firefox running too long.

    --
    Klingon programs don't timeshare, they battle for supremacy.
    1. Re:1 TB of memory... by digital+bath · · Score: 5, Funny

      Of course, there's quite a few complete operating systems that can boot in the amount of RAM required by emacs :)

      emacs, for starters
      --
      find / -name "*.sig" | xargs rm
    2. Re:1 TB of memory... by osu-neko · · Score: 5, Funny

      Of course, there's quite a few complete operating systems that can boot in the amount of RAM required by emacs

      Yes, but they're substantially less functional operating systems than Emacs.

      --
      "Convictions are more dangerous enemies of truth than lies."
    3. Re:1 TB of memory... by frovingslosh · · Score: 5, Insightful
      I'm not sure why people are rating your post as funny. I have not had moderator points in a long time, but if I did I would mark it insightful.

      As to the problem of how to use 1 TB of RAM, spending any time at all thinking of this is foolish and wasteful. Of course, I remember the days when we rated our computers in how many kilo bytes of memory we had, and plenty of readers here will remember having 20 to 40 meg hard disks in PC's with far less than 1 meg of physical RAM memory. In those days (and I'll avoid the famous Bill Gates quote on the subject), how would you have spent your time deciding what to do with the memory if you had a computer with 1 gig, 2 gig or even 4 gig of memory? You may have come up with all sorts of amazing ideas. But none of them would have done you any good, because the developers (Mostly Microsoft, but Linux is far from lean and mean any more either) already decided what to do with it, waste it and leave you wanting more. And one of your ideas for a 4 gig system might not have even been to just pretend that most of the last gig of memory wasn't there and ignore it!

      So why even have a post about what to do with a terabyte of memory? The solution is simple, install Windows 9 and try to quickly order more memory on-line before the memory hungry service pack comes out, forces it's install on you, and your TB isn't enough.

      --
      I'm an American. I love this country and the freedoms that we used to have.
    4. Re:1 TB of memory... by Shai-kun · · Score: 5, Funny

      Doesn't emacs run vi by now?

      --
      ...or so I've been told.
    5. Re:1 TB of memory... by Usquebaugh · · Score: 5, Insightful

      In the early 80s there was this funny machine called a System/38 from IBM that morphed in the AS/400 that is now called an iSeries. Now this machine was a RDBMS engine with simple green screens attached.

      Under the covers the System/38 was a cisc box, the AS/400 could be CISC or RISC and the iSeries is all risc. From an app dev point the same compiled object code could run on all three. Stop and think about for a second.

      Now the System/38 had a very advanced constraint based security system. For example you could use an object that you could not see. But in general is allowed for very fine grain control of security. Of course this has been improved throught to the iSeries.

      Also, this machine had a single address space for all storage. An app didn't need to worry about memory size, the machine automatically used ram as disk and disk as ram.

      Of course this machine has had a life of 30+ years and most OS designers have zero idea about just how revolutionary it is same sort of thing as the MCP for a Burroughs B5000. People who do not know history are doomed to repeat it over and over again.

    6. Re:1 TB of memory... by masterzora · · Score: 5, Funny

      Fortunately, you can run vi inside emacs, so it does indeed have a good text editor.

      --
      Remember, open source is free as in speech, not free as in bear.
  2. You only need 16GB of RAM for this to be useful by 2nd+Post! · · Score: 5, Insightful

    Given that the core components of an OS are only a few GB, even 8GB systems might be able to do this, today.

    1. Re:You only need 16GB of RAM for this to be useful by Kjella · · Score: 5, Insightful

      Personally I just wish there was better cache hinting on current software. For example, playing a huge movie will swap out all my software to disk even though the 30GB Blu-Ray movie will likely be played start-to-finish once and give no benefit whatsoever. To the best of my knowledge (at least I've never seen it exposed to any API I've used), there's nothing like "Open, for reading, with READ cache but don't bother keeping it around in SYSTEM cache" flags.

      --
      Live today, because you never know what tomorrow brings
    2. Re:You only need 16GB of RAM for this to be useful by QuoteMstr · · Score: 5, Insightful

      See posix_fadvise. Using that API, a process can have as much control over a file as it needs; too bad the kernel does basically nothing with that information.

    3. Re:You only need 16GB of RAM for this to be useful by Anonymous Coward · · Score: 5, Interesting

      Did I hear a summer of code application?

  3. 8 GB by Rinisari · · Score: 5, Funny

    I have 8 GB of RAM and rarely use more than four of it unless I'm playing a 64-bit game which eats it up (Crysis). Yes, I am running both 64-bit Linux and Windows.

    One time, I opened up more than a thousand tabs in Firefox just because I could.

  4. uh - there is at least one system with 1TB of RAM by Anonymous Coward · · Score: 5, Informative

    You wrote: "We haven't yet reached a point where systems, even high-end boxes, come with a terabyte of installed memory" - this is not true. Sun's E25k can go over 1TB of memory.....

  5. How ? by herve_masson · · Score: 5, Funny

    // Use 1TB of RAM
    char *ptr=malloc(1099511627776);
    memset(ptr,1,1099511627776);

  6. Re:Memory usage by wizardforce · · Score: 5, Interesting

    since we aren't even close to having boxes with more memory than we actively use
    640k should be enough for anyone. you do realize that the fact that computer manufacturers are happy bundling over 2 gigs of RAM in a default install so it runs Vista all prettily gives the linux users of us a fantastic advantage when we don't use anywhere near that on a regular basis. there are already linux distros that are small enough as to be sitting entirely in RAM, some even small enough to run on the L2+3 cache if you like. being able to do things like this is going to be a major advantage.
    --
    Sigs are too short to say anything truly profound so read the above post instead.
  7. Re:Power Failure by itsjz · · Score: 5, Informative
    There's about three paragraphs in the article discussing this. Basically, use a UPS:

    If line power goes out while ramback is running, the UPS kicks in and a power management script switches the driver from writeback to writethrough mode. Ramback proceeds to save all remaining dirty data while forcing each new application write through to backing store immediately.
  8. Oh yea? by SeePage87 · · Score: 5, Funny

    Well I can do cock push-ups.

  9. Mobile much? by tepples · · Score: 5, Insightful

    Now that it's 2008 and every new computer has a few gigs of RAM Handheld computers don't.

    There is no reason to write tiny apps in assembly anymore. Other than the fact that embedded systems outnumber PCs?
  10. Speed vs tmpfs? by SanityInAnarchy · · Score: 5, Interesting

    How it seems to work:

    Actual "ramdisk" -- that is, like /dev/rd -- that is, appears as a block device. You can run whatever filesystem you want on it, but it's still serializing and writing out to... well, RAM, in this case. No sane way for the kernel to free space on that "disk" that's not actually used.

    How I wish it worked:

    No Linux that I know of has used an actual ramdisk in forever. Instead, we use tmpfs -- a filesystem which actually grows or shrinks to our needs, up to an optional configurable maximum size. It'll use swap if available/needed. It's basically a RAM filesystem, instead of a RAM disk.

    Even initrds are dead now -- we use initramfs. Basically, instead of the kernel booting and reading a ramdisk image directly to /dev/rd0, it instead boots and unpacks a cpio archive (like a tarball, but different/better/worse) into a tmpfs filesystem, and uses that.

    So, how I would like this to work is, use a tmpfs filesystem -- as I suspect it will be faster, and in any case simpler, than a ramdisk -- and back it to a real filesystem on-disk. The only challenge here is that it's not as deterministic -- it would be more like a cp than a dd.

    An even better (crazier) idea:

    Use a filesystem like XFS or Reiser4 -- something which delays allocation until a flush. In either case, it would take a bit of tweaking -- you want to make sure no writes, or fsyncs, block while writing to disk, so long as the power is on -- but you'll hopefully already be caching an obscene amount anyway, so reads will be fast.

    In this case, forcing everything out to disk could be as simple as "mount / -o remount,sync" -- or something similar -- forcing an immediate sync, and all future writes to be synchronous.

    Conclusion:

    Either of the two ideas I suggested should work, and could perform better than a traditional ramdisk. If it is, in fact, a simple disk-backed ramdisk (not ram filesystem), then it's both not as flexible (what if your app suddenly wants 50 gigs of RAM in application space?) and a bit of a hack -- probably a hack around traditional disk-backed filesystems not being able to take advantage of so much RAM by themselves.

    In fact, glancing back at TFA, it seems there are some inherent reliability concerns, too:

    If UPS power runs out while ramback still holds unflushed dirty data then things get ugly. Hopefully a fsck -f will be able to pull something useful out of the mess. (This is where you might want to be running Ext3.)

    Now, true, this should never happen, but in the event it does, the inherent problem here is that the ramdisk doesn't know anything about the filesystem, and so it doesn't know in what order it should be writing stuff to disk. Ext3 journaling makes NO sense for a ramdisk when the ramdisk itself knows nothing about the journal -- the journal is just going to slow down the RAM-based operation. Compare this to a sync call to XFS -- individual files might be corrupted, but all the writes will be journaled in some way, so at least the filesystem structure will be intact.

    This gets even better with something like Reiser4's (vaporware) transaction API. If the application can define a transaction at the filesystem level, then this consistent-dump-to-disk will happen at the application level, too. Which means that while it would certainly suck to have a UPS fail, it wouldn't be much worse than the same happening to a non-ramdisk device, at least as far as consistency goes. (Some data will be lost, no way around that, but at least this way, some data will be fine.)

    --
    Don't thank God, thank a doctor!