Creating a Swap File for the Dreambox? making it faster etc?

dibbers

Premium Member
Premium Member
Joined
May 18, 2005
Messages
11,797
Reaction score
1,387
Location
Ipswhich
I always create a swap file for the Dreambox I'm under the impression that this will speed it up as (like window does) does it use it as a temp place for the system on the dream?

Thanks

I know the processor will only handle as much as it can of course and therefore this might be fruitless but any system that you can create a "swap" file has got to be a bonus?


Cheers


Dibbs.
 
I'd be surprised if a DM did need a swap (and even more surprised if having one speeded it up). Linux kernels use different virtual memory allocation algorithms than Windows systems and won't try to page to a swap device unless it really, really needs to.

Also, if you do have a swap file (or partition) on your disk, you could have to wait several seconds for the disk to spin up if/when the DM does decide to swap - or, worse, it keeps the disk spinning to keep the swap file's data structures up to date.
A quick
cat /proc/meminfo
of my DM800SE shows the following:
root@dm800se:~# cat /proc/meminfo
MemTotal: 137460 kB
MemFree: 6080 kB
Buffers: 1080 kB
Cached: 59116 kB
SwapCached: 0 kB
Active: 83720 kB
Inactive: 22812 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 137460 kB
LowFree: 6080 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 46304 kB
Mapped: 11116 kB
Slab: 15288 kB
PageTables: 492 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 68728 kB
Committed_AS: 193580 kB
VmallocTotal: 262136 kB
VmallocUsed: 8228 kB
VmallocChunk: 253632 kB

Note the MemFree line, shows there's not a lot of free memory. That's perfectly normal, as Linux kernels will allocate free mem to the buffers/cache in preference to not using it. As soon as it needs more Active pages, it'll dynamically reduce the size of the cache and free up memory for use.
So far as temp space goes, on Linux boxes temporary files are traditionally stored in the /tmp directory. On a DM this is mounted on the box's internal memory and will, if you put too much stuff there, fill up the box's memory - possibly to the point of crashing it.
However, as my doctor says when I complain that my leg hurts after a 10km run "then don't do it" :) It's reasonable to expect that any Image or plugin implementor of any worth would NOT stash vast amounts of data in /tmp - as they'd get a reputation for producing crashy code of poor quality.
 
Last edited:
Thanks very much for that, makes great sense, there's an option to enable the swap file on the dream (as you may well know) and i just put two and two together and then came up with 8 lol......what would it be used for then on a Dreambox? i always enable it, but as you say i was windows based thinking.....


Thanks
 
The swap file is basically just a way of adding virtual RAM to a system by allowing the system to page RAM memory to/from the disk on an on-demand basis. Effectively a task which has finished its timeslice can have all its ram memory dumped to the disk file and that RAM memory can then be used by some other task during its active period. When the processor re-activates the original task then the original dump can be read back and then things proceed as if it had never moved. Multiple tasks can therefore apparently all use the same memory at the same time making it appear your system has oodles of RAM.

The problem with a disk based swap files are they are relatively slow. The process of bundling up a taskspace and writing it to or reading from disk takes literally millions of processor cycles. Unless you really do have a problem with a lack of RAM then its best to avoid it. Linux OS's (and WIndows too, they really aren't that different in terms of swap files) wont use the swap until absolutely necessary but still need to process quite a lot of code to determine that necessity. If you know that you have enough RAM then the system will be more efficient if you turn the swap ability off altogether and save the processor from having to make a constant decision.
 
Last edited:
If you know that you have enough RAM then the system will be more efficient if you turn the swap ability off altogether and save the processor having to make a the constant decision.

Very interesting nozzer,what do you reckon is enough RAM??

and I know "how long is a piece of string" lol

just looking for a ball park figure :)

EDIT:I'm talking about a windows 7 machine here
 
Thanks for that, i funnily enough have it turned off now....... good read. cheers
 
Very interesting nozzer,what do you reckon is enough RAM??

and I know "how long is a piece of string" lol

just looking for a ball park figure :)

EDIT:I'm talking about a windows 7 machine here

Wiz mate to be honest i wouldn't worry about it on a Windows 7 based pc as long as you have a few matched pairs of ram in it, swap files were and are old skool if i'm correct, like windows 98 and XP, Linux etc?
 
Wiz mate to be honest i wouldn't worry about it on a Windows 7 based pc as long as you have a few matched pairs of ram in it, swap files were and are old skool if i'm correct, like windows 98 and XP, Linux etc?

I'm trying to figure out whether I would benefit from disabling it dibbs m8 :)

then again I'm probably getting it mixed up with virtual ram settings lol
 
Disable what mate? in windows? na leave that all alone man and let the system manage it...

20-11-201120-14-0d5.jpg

20-11-201120-13-47.jpg
 
just a thought, if i create the swap file to a usb stick then in effect it's using no moving parts like the HDD, so a kick as fast data transfer usb stick would benifit if the "swap file" is needed?
 
Last edited:
Very interesting nozzer,what do you reckon is enough RAM??

and I know "how long is a piece of string" lol

just looking for a ball park figure :)

EDIT:I'm talking about a windows 7 machine here


For Win7, on an average PC that doesn't do too much in the way of multitasking then 1.5Gig is probably enough (I'd likely go for 2Gig though, so the memory is all matched). If your concerned then open up your task manager and have a look at where all the memory is going and how much you have left free.

For Windows 7 (or pretty much any version of windows) it will likely recommend that the disk paging file is at least the same size as your physical ram when you install. All Win NT based OS's use an algorithm to swap memory which is partly based on when a process was last utilised. Any process that is blocked (waiting for keyboard entry or some other I/O) can be paged out of real physical RAM to the paging file. Even with lots of system memory, you'll usually see around 250Mbytes or more paged, simply because it isn't presently active. Virus scanners especially tend to get paged out because, unless your accessing a file, there's not much call for their services.
 
Back
Top