- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Yet another memory question.
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 01:19 PM
02-10-2003 01:19 PM
Yet another memory question.
When i run "ps -elf | awk '{ sum += $10*4096/1024/1024 } END { printf "%ld\n", sum }'" I get 2248 or 2.25gb used. What gives? I need an accurate portral of utilization by process.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 01:20 PM
02-10-2003 01:20 PM
Re: Yet another memory question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 01:42 PM
02-10-2003 01:42 PM
Re: Yet another memory question.
#!/usr/bin/sh
MEM=$(UNIX95= ps -f -o vsz | awk 'BEGIN {
sum = 0
}
{
if (NR > 1) sum += ($1 + 0)
}
END {
printf("%d\n",sum)
}')
echo "MEM = ${MEM}"
NOTE the UNIX95=
That's what the (NR > 1) does.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 01:45 PM
02-10-2003 01:45 PM
Re: Yet another memory question.
For ps, the sz column contains text, data and stack but this isn't a complete picture. Glance gives you a better picture. You can get a simple view with ps which is good enough for a virtual memory machine. When RAM is short, the operating system will quietly return sone system memory such as the buffer cache and eventually start deactivating processes and paging to the swap area. The metric of interest is the page out rate (seen with vmstat or Glance).
Here's a quick way to sort all processes by the Kbytes of RAM they are using as reported by ps:
UNIX95= ps -e -o vsz,pid,args | sort -rn | more
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 01:50 PM
02-10-2003 01:50 PM
Re: Yet another memory question.
Another way of looking at the used memory is to do a vmstat 2 2 and note down the free pages.
Your used memory in bytes = Total Memory - (free pages * 4096).
This includes all usages.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 02:14 PM
02-10-2003 02:14 PM
Re: Yet another memory question.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2003 02:15 PM
02-10-2003 02:15 PM
Re: Yet another memory question.
If you have Glance, try the adviser syntax posted at this link:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x61d4a848deccd61190050090279cd0f9,00.html
Mladen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2003 11:40 AM
02-11-2003 11:40 AM
Re: Yet another memory question.
1) In your first post, you were adding up the values under SZ. In your second post, you were adding up the values under VSZ. If you are trying to account for physical memory used, then I think SZ is the relevant value.
2) However, the man pages for 'ps' describe 'sz' as follows:
"The size in physical pages of the core image of the process, including text, data, and stack space"
What is missing is "shared memory RSS". So, for example, if you have a process that locks 1Gb of shared memory, then at least 1Gb of physical memory will not be accounted for when you add all SZ values as in your original post.
There are other types of memory pages that are included in the total user memory, but are not accounted for by adding all SZ values. Some of this user memory, as reported under HP-UX 11.00 is interpreted as system memory under HP-UX 11.11. See this link for more details:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x3f2a31ec5e34d711abdc0090277a778c,00.html
3) In Glance, you can look at various memory regions for each process, and compare these values with the output from 'ps'. On my system, for example, I have a Sybase process that uses 7Gb of shared memory, but SZ is reported as only 17 Mb ! The Glance's RSS, on the other hand, does try to account for the shared memory segment, but this is also inaccurate - the link of my previous post will give you more details about this problem.
Mladen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2003 12:34 PM
02-11-2003 12:34 PM
Re: Yet another memory question.
Memory Stat total used avail %used
physical 32764.0 8058.4 24705.6 25%
active virtual 531.3 128.9 402.4 24%
active real 597.0 136.0 461.0 23%
memory swap 26522.5 3738.2 22784.3 14%
device swap 2378.0 2365.5 12.5 99%
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2003 08:34 AM
02-19-2003 08:34 AM
Re: Yet another memory question.
Does your c program require anything special to compile? Having trouble with it. Thanks.