Could Sd Cards, In Theory, Be Used As Ram In A Linux Environment?


Arkay Firestar

Very Active Member
Joined
Apr 28, 2010
Messages
243
"I'm quite unfamiliar with Linux" should serve as an adequate preface/disclaimer for what might be a silly/stupid question, but discussions regarding the amount of RAM in the Pandora have stirred my curiosity as to whether an analogy exists in a Linux environment for what Vista/7 offer x86/x64 platforms in terms of ReadyBoost. In short, is it possible for the SD card slots to be used as system memory?

If so, could this not, in theory, dramatically increase the available system memory? If not, would it be a limitation of the platform, the speed of the card slots, or perhaps just a reflection of how demanding/difficult such a feature was to design/implement in the first place?

Thanks.
 
Arkay Firestar said:
"I'm quite unfamiliar with Linux" should serve as an adequate preface/disclaimer for what might be a silly/stupid question, but discussions regarding the amount of RAM in the Pandora have stirred my curiosity as to whether an analogy exists in a Linux environment for what Vista/7 offer x86/x64 platforms in terms of ReadyBoost. In short, is it possible for the SD card slots to be used as system memory?

If so, could this not, in theory, dramatically increase the available system memory? If not, would it be a limitation of the platform, the speed of the card slots, or perhaps just a reflection of how demanding/difficult such a feature was to design/implement in the first place?

Thanks.
This has been discussed quite a bit. ReadyBoost is not the same thing as what you're describing - it's a way of using flash memory to speed up random access to data on the hard drive, which works because flash memory is faster at random reads than a hard drive is. Since the Pandora doesn't have a hard drive, this would be fairly pointless.

On the other hand, you can use an SD card for swap space, which is more what you seem to be describing. This would indeed enable you to run applications that required more than the available amount of system memory, but it may not be extremely useful, since access to the SD cards is much, much slower than access to RAM. (In theory, if you use this heavily, you could also wear out your SD card doing this, particularly if it is not well-manufactured - but in practice this is quite rare.) It is quite possible, though, and the capability is built into the OS.
 
Last edited by a moderator:
You're right, definitely the latter is what I had in mind. And you're certainly correct about the issue of wear as well. I actually used to work for an OEM memory company and I'm quite versed on the quality/longevity of MLC (consumer-grade) flash. Still, considering the cost and possible benefits, I'd be game to use one slot for a 32GB normal-use card and the other for a 4-or-so-GB card used to augment the swap file. For what I'm planning to use the Pandora for (8/16-bit emulation plus some basic desktop stuff like internet, music/video, and email), it probably won't be of much concern anyways. The processor is far more likely to be the bottleneck. But you never know, maybe some application comes around that requires more temporary room to work with, and that's where something like this would be great.

Sorry for digging up an old discussion. I've lurked for a while but I'd missed that one.
 
ed: like Tom said it would wear SD cards out but not as much as you might think and has little impact as SD cards are dirt cheap, literally. So I'm actually intrigued about the answers that will come to follow about such implements.

I've heard OpenOffice takes alot of memory so this just might be useful with a really fast SD card (regardless of capacity).
Dunno really, just throwing it out there hehe
 
atomicthumbs said:
but swap can wear out memory cards faster
I've been using a swap file on a Transcend 4Gb SD for about 3-4 years. It still works fine, no bad sectors etc.
 
Last edited by a moderator:
Using swap should only really be to make things possible, it's highly unlikely to make anything faster.
Anything that uses much more swap than actual memory (ie more than 512MB overall) is still unlikely to be remotely usable, unless it's just a massive cache.
I doubt there will be many applications that you could run effectively with swap that you couldn't otherwise.
 
at one point when i had a 128 mb pandora board, i was working on somthing that needed more so I created a swap on one of the sd cards and it worked.
 
Pickle said:
at one point when i had a 128 mb pandora board, i was working on somthing that needed more so I created a swap on one of the sd cards and it worked.
The step-by-step for doing this would be a nice addition to the wiki. :)
 
Last edited by a moderator:
I don't know if hibernation is implemented in the Pandora's Ångstrom release, but if the possibility exists, a 512mb swap space on an SD card could allow it. Hibernation usually takes less time than a full boot up cycle, and uses no power. In the long run, it might not be useful, but if someone is already using swap space on an SD card, why not?
 
Ollonk said:
I don't know if hibernation is implemented in the Pandora's Ångstrom release, but if the possibility exists, a 512mb swap space on an SD card could allow it. Hibernation usually takes less time than a full boot up cycle, and uses no power. In the long run, it might not be useful, but if someone is already using swap space on an SD card, why not?

+1
Hibernation is pretty awesome. Once configured, have it set to Hibernate once you close the clamshell ...drools
 
Last edited by a moderator:
SD cards have a certain lifespan. Once the sectors on the cards are used an X number of times they are off to the graveyard. Swap memory or something like that heavily reduces the lifespan of the card as the sectors are being overwritten quite a number of times when the card is actively used. So, yes it's possible, but it comes at a certain cost.

Also, real RAM is much faster than any SD card out there. And nothing beats a perfectly fine-tuned OS that uses the main RAM as its memory source. Since the Pandora will be based on one specific hardware configuration, the OS is also way more optimizable than a PC based OS (which has a bazillion different combinations).

ReadyBoost is a feature that was introduced in Windows Vista, but it was heavily argued about if it made any performance enhancements at all. I have seen many different graphs of the differences between systems with and without ReadyBoost, and I conclude that it is not worth any investment. Maybe OpenPandora and the community can make something more useful than Microsoft, but this is some pretty advanced stuff that is going to take a very long time to develop. If I could program then I would rather invest all my time in the enhancing the basic features and speed of the standard OS.
 
It's a bit advanced but not a problem for openpandora, it's already there. You use mkswap to make the swap partition or file, then swapon to add it in (or put it in fstab to add it at bootup).
 
Swap space, this will remind me of the good old days. Modern PCs running Linux don't use swap space anymore. I think when you have anything over 2 gigs of ram it's not used, so it's been a while for me. It shouldn't be hard to create a swap space on an SD card, but that means that the SD card that has the swap space on it can't be removed. Then again I don't know why anyone would want to remove an SD card in the middle of a game. I guess programs could use it also, so maybe checking if it was in use before removal would be a good idea.

@ Wootson Even if swap is there the system won't use it unless it absolutely needs to so it won't see much activity. I haven't used swap for so long I can't remember if it's possible to set only certain applications to use it but that would be useful.
 
second exodous said:
I think when you have anything over 2 gigs of ram it's not used, so it's been a while for me.
Linux eats unused memory. I have 4Gigs of RAM and usually there's only ~3-5% free. According to `/proc/meminfo` it's mostly used for buffers and caching.
 
Last edited by a moderator:
Vitel said:
second exodous said:
I think when you have anything over 2 gigs of ram it's not used, so it's been a while for me.
Linux eats unused memory. I have 4Gigs of RAM and usually there's only ~3-5% free. According to `/proc/meminfo` it's mostly used for buffers and caching.
Is it a matter of using as much memory as available, why not use it if it's there and free? (question not statement)
 
Last edited by a moderator:
Vitel said:
second exodous said:
I think when you have anything over 2 gigs of ram it's not used, so it's been a while for me.
Linux eats unused memory. I have 4Gigs of RAM and usually there's only ~3-5% free. According to `/proc/meminfo` it's mostly used for buffers and caching.
Hmm, really? I never have very high use of my memory. I'm sure when I play recent games it goes up but I just use it for desktop use and I never get into swap. Right now I'm running firefox, rhythmbox and the normal stuff like compiz and such, that is basically all I use most of the time and I'm using around 14% of my 4 gigs of memory. I have 2 gigs of swap and have never seen it used, I just keep it around because when I ask Linux gurus they always say keep it around at half your memory just in case.

Do you have a Linux server? I'm guessing that uses more memory than desktop. Pandora wise I don't know how much memory it will use since every program that will run on it will have memory limitations in mind.
 
Last edited by a moderator:
second exodous said:
Hmm, really? I never have very high use of my memory. I'm sure when I play recent games it goes up but I just use it for desktop use and I never get into swap. Right now I'm running firefox, rhythmbox and the normal stuff like compiz and such, that is basically all I use most of the time and I'm using around 14% of my 4 gigs of memory. I have 2 gigs of swap and have never seen it used, I just keep it around because when I ask Linux gurus they always say keep it around at half your memory just in case.

Do you have a Linux server? I'm guessing that uses more memory than desktop. Pandora wise I don't know how much memory it will use since every program that will run on it will have memory limitations in mind.
I don't think most simpler memory usage indicators actually bother to include kernel cache, since it might as well not be there in terms of anything else needing it, and also it would mean it was 99% nearly all the time.
 
Last edited by a moderator:
second exodous said:
Do you have a Linux server?
I have a Linux server, but the statement about is about my notebook.

second exodous said:
I never have very high use of my memory. I'm sure when I play recent games it goes up but I just use it for desktop use and I never get into swap. Right now I'm running firefox, rhythmbox and the normal stuff like compiz and such, that is basically all I use most of the time and I'm using around 14% of my 4 gigs of memory. I have 2 gigs of swap and have never seen it used, I just keep it around because when I ask Linux gurus they always say keep it around at half your memory just in case.
How do you calculate amount of free memory?

`top` shows 'real mem usage', which is four top lines from `/proc/meminfo`.
Code:
Mem:   3951928k total,  3895204k used,    56724k free,    24248k buffers
But `conky`, for example, treats memory used for buffers and caching as free. I.e:
Code:
#!/bin/sh

MemFree=`cat /proc/meminfo | grep MemFree: | awk '{print $2}' | sed 's/k//'`
MemBuffers=`cat /proc/meminfo | grep Buffers: | awk '{print $2}' | sed 's/k//'`
MemCached=`cat /proc/meminfo | grep ^Cached: | awk '{print $2}' | sed 's/k//'`
MemTotal=`cat /proc/meminfo | grep MemTotal: | awk '{print $2}' | sed 's/k//'`
MemFreePercent=$((100 * ( $MemFree + $MemBuffers + $MemCached ) / $MemTotal ))

echo "Free RAM: $MemFreePercent%";
 
Last edited by a moderator:
Something to keep in mind is the fact that ARM instruction sets, by their nature, tend to use larger blocks of memory than their x86 counterparts.
 
Back
Top