PDA

View Full Version : Linux Q. pt 3 - Memory Usage in RedHat 8



Chilling_Silently
13-05-2003, 08:23 PM
How much RAM should Linux be using?

I took this screen shot earlier:
http://sal.neoburn.net/pf1images/mem.png

Notice the Memory Usage?
Why's it so high?

Swap file isnt being used at all (Note down the bottom too... its CPU, then Mem, then SWAP).

Just been playing another Music Vid, and its now @ 100% usage and staying there - Its making the vidz jump and jerk as well.

Why is it so high?
The process X is around 250 MB.

Have I done something wrong, and how would I go about freeing this memory.

BTW - Ive update the nVidia drivers sucessfully too :-)

Cheers


Chill.

bmason
13-05-2003, 08:56 PM
Its most likely the disk cache & buffers eating up the rest, same as with windows. Which won't be causing the playback problems.

If you run "top" in a terminal it will show you how much is cache/buffer. eg from mine:

Mem: 515336k total, 508880k used, 6456k free, 42152k buffers
Swap: 578300k total, 8164k used, 570136k free, 226508k cached

508M - 42M buffers - 226M cache = 240M allocated. Which isn't too bad since eclipse is eating > 120M of that.

If you want to see whats eating up the rest of your memory you can sort the processes by memory usage by pressing "M" (yes case matters & no X isn't really using that much).

* There is a gnome programme that does the same as top but I can't remember what its called.

Chilling_Silently
13-05-2003, 09:20 PM
yeah - Ive used the applet.. it was in the screenshot - just the secondary tab.

The thing is as soon as I logged out and then back in, half the mem was free again! I played a Vid on Xine perfect too!

What exactly are the Cache and Buggers? Do I need them - and do they needa be that big?

This is the first time ALL my RAM has been used - Doze only really gets to 200MB Max :-)

Thanks for all your helps

Cheers


Chilling_Silence

bmason
13-05-2003, 10:17 PM
> The thing is as soon as I logged out and then back
> in, half the mem was free again! I played a Vid on
> Xine perfect too!

I'm not sure about that. When you log out it will kill off any apps you running which will free memory. How much of the memory is allocated to cache/buffers?

> What exactly are the Cache and Buggers? Do I need
> them - and do they needa be that big?

The disk cache is the same as the one in windows. It holds a copy of recently accessed files so it doesn't need to get them off disk next time you need them. I'm not sure about buffers, but I think its similar.

If the memory wasn't being used for cache it would be wasted most of the time. Linux shrinks the size of the cache when the memory is needed for something else.

> This is the first time ALL my RAM has been used -
> Doze only really gets to 200MB Max :-)

Hmm. Win98 will use all the memory I give it provided I run it long enough to find enough stuff worth caching.

Are you limiting the size of the windows cache? Perhaps its 200M excluding the cache?

Chilling_Silently
13-05-2003, 10:37 PM
> > The thing is as soon as I logged out and then back
> > in, half the mem was free again! I played a Vid on
> > Xine perfect too!
>
> I'm not sure about that. When you log out it will
> kill off any apps you running which will free memory.
> How much of the memory is allocated to cache/buffers?

Here's a sample from top:

9:32pm up 5:09, 1 user, load average: 0.24, 0.26, 0.33
90 processes: 86 sleeping, 4 running, 0 zombie, 0 stopped
CPU states: 17.4% user, 2.7% system, 0.0% nice, 79.7% idle
Mem: 513952K av, 504760K used, 9192K free, 0K shrd, 26544K buff
Swap: 128512K av, 0K used, 128512K free 339876K cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
6864 root 15 0 16628 16M 4944 S 9.5 3.2 1:09 xine
1505 root 5 -10 280M 24M 12432 S < 4.9 4.9 4:53 X
6273 josiah 15 0 9392 9388 6832 R 4.7 1.8 0:12 gnome-terminal
7050 josiah 15 0 1052 1052 836 R 0.5 0.2 0:00 top
1568 josiah 15 0 6920 6920 5560 S 0.1 1.3 0:16 metacity
1583 josiah 15 0 14232 13M 10076 S 0.1 2.7 0:03 nautilus
1867 josiah 15 0 7916 7912 6532 S 0.1 1.5 0:02 geyes_applet2
1 root 15 0 476 476 424 S 0.0 0.0 0:03 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 keventd
3 root 15 0 0 0 0 SW 0.0 0.0 0:00 kapmd
4 root 34 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU0
5 root 15 0 0 0 0 SW 0.0 0.0 0:00 kswapd
6 root 25 0 0 0 0 SW 0.0 0.0 0:00 bdflush
7 root 15 0 0 0 0 SW 0.0 0.0 0:00 kupdated
8 root 25 0 0 0 0 SW 0.0 0.0 0:00 mdrecoveryd
12 root 15 0 0 0 0 SW 0.0 0.0 0:00 kjournald

Dunno how PF1's gonna spit it out thou :p

>
>
> > What exactly are the Cache and Buggers? Do I need
> > them - and do they needa be that big?
>
> The disk cache is the same as the one in windows. It
> holds a copy of recently accessed files so it doesn't
> need to get them off disk next time you need them.
> I'm not sure about buffers, but I think its similar.
>
> If the memory wasn't being used for cache it would be
> wasted most of the time. Linux shrinks the size of
> the cache when the memory is needed for something
> else.

Okay... so a quick logoff will fix it back down then? For now, Its still @ 100% Memory use, and the Vidz are playing fine.. Perhaps I should look into replacing my SD-RAM with DDR.. Its getting real cheap now :-)

> > This is the first time ALL my RAM has been used -
> > Doze only really gets to 200MB Max :-)
>
> Hmm. Win98 will use all the memory I give it provided
> I run it long enough to find enough stuff worth
> caching.
>
> Are you limiting the size of the windows cache?
> Perhaps its 200M excluding the cache?

Ive limited my Swap File (Virtual Memory).. and I see the changes reflected in the swapfile on the C: drive.

I wouldnt have a clue about anything else though..
Im using Win2K and got the data by hitting Ctrl + **** + Esc :-)

Thanks



Chill.

bmason
13-05-2003, 11:06 PM
> Here's a sample from top:
>
> CPU states: 17.4% user, 2.7% system, 0.0% nice,
> 79.7% idle
> Mem: 513952K av, 504760K used, 9192K free,
> 0K shrd, 26544K buff
> Swap: 128512K av, 0K used, 128512K free
> 339876K cached

The actual memory allocated to programmes is 500M - 25M buffers - 340M cache = ~135M, which isn't much.

> Okay... so a quick logoff will fix it back down then?
> For now, Its still @ 100% Memory use, and the Vidz
> are playing fine.. Perhaps I should look into
> replacing my SD-RAM with DDR.. Its getting real cheap
> now :-)

It wont really "fix" it because its not broken. It might free a bit of memory, but it won't stay unused for long.

I don't think the large disk cache is causing the problems. Even win98 can handle it :-). Its just making use of memory that would be otherwise be unused to make things faster.

> I wouldnt have a clue about anything else though..
> Im using Win2K and got the data by hitting Ctrl +
> **** + Esc :-)

I don't have access to a win2k box so I can't check.

Susan B
14-05-2003, 11:10 AM
> and got the data by hitting Ctrl + **** + Esc

You have a very interesting keyboard there, Chill. Does it also have an "Any Key"? :p :D

Chilling_Silently
14-05-2003, 11:14 AM
Yes.. and I can 'Hit' Enter without breaking the keyboard too ;-)

Hey.. I was lying in bed.. couldnt really see exactly what I was typing.. I hate how Phoenix doesnt like the Mangifier.. If Im using Win2K's Magnifier, I have to load up IE (Heaven forbid :p)

joey
14-05-2003, 11:58 AM
CS, it's a function of the OS. Redhat takes up all mem from startup. The figures you're seeing aren't a true indiction of mem usage. I beleive that RH (and possibly other Linux versions) allocate most of the memory even though it's not being used. I was taught that you know when all your memory is used when you start using swap.

Hope this helps

Joey

Graham L
14-05-2003, 02:07 PM
It is most efficient to use all the memory. If it's in memory, you don't have to get it from disk.

All disk operations use cache and buffers... that bdflush task writes any changed data out to disk when appropriate. That's why you have to shutdown in an orderly way --- if the disks aren't "synched" with what's in memory, you get problems. I think the directories are in cache.

If you have problems with "jerkiness" of a task, try "nice"ing other user programms you might have running. (nice lowers the priority of a task.)
top lets you do this for your own tasks.