The Silicon Underground
  Welcome to Dave Farquhar's Silicon Underground Saturday, July 05 2008 @ 09:58 PM CDT  
Theme Changer
Change the look of the site by selecting a theme below:

What's New
STORIES
No new stories

COMMENTS last 48 hrs
No new comments

LINKS last 2 wks
No recent new links

Google Ads

User Functions
Username:

Password:

Don't have an account yet? Sign up as a New User

Firefox


Using video memory as a ramdisk in Linux   
Friday, October 12 2007 @ 05:58 PM CDT
By David L. Farquhar

An old idea hit me again recently: Why can't you use the memory that's sitting unused on your video card (unless you're playing Doom) as a ramdisk? It turns out you can, just not if you're using Windows. Some Linux people have been doing <a href="http://hedera.linuxnews.pl/_news/2002/09/03/_long/1445.html">it</a> for two years.<p>

Where'd I get this loony idea? Commodore, that's where. It was fairly common practice to use the video RAM dedicated to the C-128's 80-column display for other purposes when you weren't using it. As convoluted as PC video memory is, it had nothing on the C-128, where the 80-column video chip was a netherword accessible only via a handful of chip registers. Using the memory for anything else was slow, it was painful, but it was still a lot faster than Commodore's floppy drives.<p>

So along comes someone on Slashdot, asking about using idle video memory as swap space. I really like the idea on principle: The memory isn't doing anything, and RAM is at least an order of magnitude faster than disk, so even slow memory is going to give better performance.<p>

The principle goes like this: You use the Linux MTD module and point it at the video card's memory in the PCI address space. The memory is now a block device, which you can format and put a filesystem on. Format it ext2 (who needs journaling on a ramdisk?), and you've got a ramdisk. Format it swap, and you've got swap space.<p>

The downside? Reads and writes don't happen at the same speed with AGP. Since swap space needs to happen quickly both directions, this is a problem. It could work a lot better with older PCI video cards, but those of course are a lot less likely to have a useful amount of memory on them. It would also work a lot better on newer PCIe video cards, but of course if your system is new enough to have a PCIe card, it's also likely to have huge amounts of system RAM.<p>

The other downside is that CPU usage tends to really jump while accessing the video RAM.<p>

If you happen to have a system that has fast access to its video RAM, there's no reason not to try using it as swap space. On some systems it seems to work really well. On others it seems to work really poorly.<p>

If it's too slow for swap space, try it as a ramdisk. Point your browser cache at it, or mount it as /tmp. It's going to have lower latency than disk, guaranteed. The only question is the throughput. But if it's handling large numbers of small files, latency matters more than throughput.<p>

And if you're concerned about the quality of the memory chips on a video card being lower than the quality of the chips used on the motherboard, a concern some people on Slashdot expressed, using that memory as a ramdisk is safer than as a system file. If there's slight corruption in the memory, the filesystem will report an error. Personally I'm not sure I buy that argument, since GPUs tend to be even more demanding on memory than CPUs are, and the consequences of using second-rate memory on a video card could be worse than just some stray blips on the screen. But if you're a worry wart, using it for something less important than swap means you're not risking a system crash by doing it.<p>

If you're the type who likes to tinker, this could be a way to get some performance at no cost other than your time. Of course if you like to tinker and enjoy this kind of stuff anyway, your time is essentially free.<p>

And if you want to get really crazy, RAID your new ramdisk with a small partition on your hard drive to make it permanent. But that seems a little too out there even for me.

  [ Views: 622 ]  


Using video memory as a ramdisk in Linux | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
No user comments.
What's Related
  • More by DaveF
  • More from Linux

  • Story Options
  • Mail Story to a Friend
  • Printable Story Format


  • Calendar
    July 2008
    SuMoTuWeThFrSa
    29
    30
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    1
    2
    Click on any day to see postings and events for that date.

    Referrals

    Top 10 by Comments
    Story TitleComments
    Cheap laptops from Sotec 253
    An untrustworthy vendor 164
    Upgrading an eMachine 125
    eMachine upgrade advice 99
    Why I dislike Microsoft 51
    Upgrade diary: Gateway G6-400 35
    And we're live 30
    The day after the Columbia 22
    How to pray 22
    CD-ROM troubleshooting under Windows 9x 20

    Top 10 Read
    Story TitleViews
    eMachine upgrade advice 65558
    Upgrading an eMachine 56016
    How to view a blg file in Windows 2000 35375
    Cheap laptops from Sotec 28644
    Upgrade diary: Compaq Presario 7360 17382
    Upgrade diary: Gateway G6-400 16230
    CD-ROM troubleshooting under Windows 9x 13365
    Finding an open-source alternative to Ghost 11317
    Big trouble 10572
    Salary cap? Baseball needs something 10098

    Topics
    Home
    Apache (2)
    Baseball (59)
    Book reviews (2)
    Business (1)
    Christianity (56)
    Cooking (1)
    Copyright (15)
    Curmudgeonry (1)
    Design (7)
    DOS (6)
    Games (4)
    Genealogy (10)
    General (494)
    Hardware (140)
    Health (13)
    Human Interest (9)
    Humor/Satire (19)
    Journalism (1)
    Linux (92)
    Macintosh (22)
    Model Building (2)
    Music (32)
    net.culture (40)
    Personal (77)
    Photography (6)
    Retro Computing (24)
    Saving money (50)
    Servers and Networking (17)
    Society (45)
    Software (47)
    Spam (13)
    St. Louis (22)
    This weblog (14)
    Toy trains (72)
    Troubleshooting (7)
    Vendors (6)
    Video (20)
    Viruses (12)
    Windows (116)
    Writing (16)

    Older Stories
    Saturday 24-May
  • Escape from Windows 98 (0)

  • Thursday 22-May
  • How Generation X can take this country back (1)

  • Tuesday 13-May
  • My poor-man's SSD boots DOS really fast (0)
  • One solution to the family IT man problem: Standardize (0)

  • Monday 12-May
  • Better upgrade advice (3)

  • Friday 09-May
  • My SSD experiment, coming soon (0)

  • Tuesday 06-May
  • Fairlight in the news? (0)

  • Thursday 01-May
  • Lawnmower Adventures, Part 2 (6)

  • Sunday 27-Apr
  • Dave switches to Office 2007 (1)

  • Thursday 17-Apr
  • Being more interested in growth than being Lutheran? Hardly. (2)

  • Who's Online
    Guest Users: 4

    Syndicate!
    Get your RSS/RDF fix here.

    List of all stories
    Click here for a list of all the entries on this site


    Created this page in 1.51 seconds


     Copyright © 2008 Dave Farquhar's Silicon Underground
     All trademarks and copyrights on this page are owned by their respective owners.

    Powered by GL 1.3.x