(Not logged on) | Register | Log On

You can subscribe to this discussion group using an RSS feed reader. The Joel on Software Discussion Group

A place to discuss Joel on Software

This community works best when people use their real names. Please register for a free account.

Other Groups:
Joel on Software
Business of Software
Design of Software (CLOSED)
.NET Questions (CLOSED)
TechInterview.org
CityDesk
FogBugz
Fog Creek Copilot


The Old Forum


Your hosts:
Albert D. Kallal
Li-Fan Chen
Stephen Jones

UNIX 'Top' command

Under 'Top' there are two columns: SIZE and RES

SIZE- refers to the virtual memory

RES- refers to the resident memory used in the RAM


It is ideal to ensure that RES value is as low as possible? And to keep the RES value far below the SIZE value?
Lotus
Friday, May 16, 2008
 
 
The general wisdom is to create your swap partition to be twice the amount of ram you have, up to about 512MB swap (at least I've never bothered making a larger swap for my desktop machine).

Keep in mind that Linux will try to keep RAM as full as it possible can, so it will appear that you're hurting for RAM when you're really doing ok, the kernel is just attempting to keep the system running as quickly as possible.

I have no idea about the behavior of other unices.
Fake Programmer
Friday, May 16, 2008
 
 
Some stuff from 'man top':

VIRT  --  Virtual Image (kb)
The total amount of virtual memory used by the task.  It includes all code, data and shared libraries plus pages that have been swapped out.

VIRT = SWAP + RES.

SWAP  --  Swapped size (kb)
The swapped out portion of a task’s total virtual memory image.

RES  --  Resident size (kb)
The non-swapped physical memory a task has used.

RES = CODE + DATA.

----
Btw I don't have a 'SIZE' column when I run top, so YMMV.

But I think if you're looking for memory efficiency then I'm reasonably sure you want to be able to reduce RES as much as possible, and try to have SWAP as close as possible to RES.

The lower RES is, the less memory your program will need, the more consistently you can have SWAP approaching RES the more of your program is available to be swapped out, thereby reducing the drain on the system's memory. No idea how easy it would be to do this though; think it would require a pretty tight control over the compilation to have the most used code bundled into the smallest number of pages.

No doubt I'll probably be shot down over some gross inaccuracy, but hopefully I'm in the right vicinity of what you're asking...
Graham Allan
Friday, May 16, 2008
 
 
What is your real problem?

Are you a programmer asking how to write your program efficiently so it is not a memory hog, or a system administrator asking how to slow the system down by increasing swapping and paging so it looks like you have plenty of unused memory?

Because the latter is a really bad idea. As Fake Programmer said, most systems use "spare" memory for caching in order to run faster. Are you sure this is not what you are seeing? This memory can be instantly freed if required by an application.

That said, there are legitimate reasons for wanting to limit memory usage by processes. Perhaps one memory hog is "crowding out" another application. You may be able to do this using startup parameters of the program itself, with java vm's and databases for example, or the operating system may provide resource controls.
John L Send private email
Saturday, May 17, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz