[CS-FSLUG] Oh man

Robert W. robertwo at insightbb.com
Sat Jul 30 23:57:56 CDT 2005


On 07/30/2005 12:32:03 AM, Nathan T. wrote:
> On the topic of swap space and ram, I have 512 Mb of ram, but a high
> percentage of it is in use all the time, my swap space is always  
> taken up at least 3% despite my ram not being completely used up yet.
> 
> It was my understanding that the swap was used when the ram was full,
> it was a hard disk space used just like ram in case the actual ram  
> was filled up. Why then does the ram always seem filled most of the  
> way whether I'm using a computer with 128 Mb of ram, or a computer  
> with 512 Mb of ram, and why is the swap in use when my ram isn't full  
> yet but my computer will work without a swap partition if I choose  
> not to have one?

My understanding is that Linux allocates as much RAM as it can to disk  
buffers and other caches. But the kernel will surrender that memory if  
an application needs it. So the memory is in use, but not unusable. It  
can be freed up when necessary.

As for the swap, it's likely that something needed a bunch of memory  
(maybe while starting up). The kernel took some memory space that  
hadn't been accessed in a while, and swapped it to disk. Making more  
room for the immediate need. Whatever that memory belonged to hasn't  
asked for it back. So it stays in the swap until it's needed.

The kernel's memory allocator tries to balance buffers and application  
memory in a way that makes the machine most repsonsive. Swapping is  
more about performance than about running out of memory. At least,  
that's my impression. I have just enough knowledge about memory  
allocation to realize I'm a novice :)

-- 
Robert W.
robertwo at insightbb.com

Who of you by worrying can add a single
hour to his life? -- Matthew 6:27





More information about the Christiansource mailing list