[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Memory

Yoram Halberstam wrote:

I'm new to linux and I've got a FC10 with no server database or other servers (that I can think of) up yet - SAMBA maybe.

Anyway, my memory last night was up to 2GB - I expected a basic system to be 500m or less...?!

How can I find out the culprit processes and make my system leaner? Any website to tell me what each processes in memory does to check if I need it?


Yoram Halberstam

Sometimes, the simple answer is best, but just in case you want more ...

Linux treats all memory as 'virtual'. Swap space is appended to physical RAM to form a virtual memory stack.

It helps me to think of virtual memory as a horizontal bar, with kernel and reserved memory to the left, and swap space to the right.

Kernel and reserved memory, once loaded, become fixed in place and will not move. However, the kernel takes care not to load itself in the same order each time. From there, an application space is created, and to the right of that are buffers and cache.

As memory is consumed by applications, it pushes the buffers and cache to the right, towards the swap area. However, cache and most buffers will not move onto physical swap, they are simply deleted before that. If applications push too far to the right, they can push into physical swap.

If the application space pushes into the physical swap area performance is degraded, but the system can survive, and will recover if those applications begin to use less memory. But the consequences can be severe depending upon the work load. It should occur to you that cache space is exhausted if apps are in physical swap.

If a system with little to no disk cache space is doing many read writes , the system will grind to a stand still, waiting on i/o from the drives. Disk drives are very slow in comparison to other types of operations.

I have over simplified a bit here to try and illustrate how memory is treated. The bottom line is that since all memory is 'virtual', no swap space is needed, but if it is needed and not there, the system may not recover.

For instance: A desktop with 512MB RAM will need swap space. A desktop with 8GB RAM can safely run with no swap. (for now -- programmers like to write to the space available).

Linux, and all modern UNIX systems, will attempt to use all available memory to improve performance. It is expected that even a simple desktop will, over time, use all available RAM mostly as cache, just in case the apps may need it again sometime.

There is a program, or rather a set of tools, called munin in the Fedora repositories. The memory charts reported by that tool graphically show this 'bar', although vertically, over time. It can be illuminating.

I have a short term sample of a desktop running here:


Good Luck!

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]