<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Available Memory Info Problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924317#M110211</link>
    <description>&lt;BR /&gt; Hi James,&lt;BR /&gt;&lt;BR /&gt; Very useful commands, especially for finding the buffer cache size; seems that here resides the "lost" memory; I found that basically what top says it's free is what vmstat also reports and the difference (after including the process memory read with pstat call and eliminating duplicate text segments) is mainly this cache. Is there a way to find how the memory (pseudo) swap system handles memory (how much it reserves and uses)?&lt;BR /&gt;&lt;BR /&gt;  Thanks a lot&lt;BR /&gt;</description>
    <pubDate>Tue, 11 Mar 2003 16:36:17 GMT</pubDate>
    <dc:creator>Vladimir Tihu</dc:creator>
    <dc:date>2003-03-11T16:36:17Z</dc:date>
    <item>
      <title>Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924313#M110207</link>
      <description>With a program that uses pstat_getprocvm() call we find that real memory of all processes is Text+Data+Stack+Shared+MM: 1201 Mb (virtual 1768).&lt;BR /&gt;   swpainfo -atm gives for the memory line 6340=available    4386=used    1954=free&lt;BR /&gt;   top says 2091872K free (2043Mb)&lt;BR /&gt;   The question is what occupies the memory up to what top or swapinfo report? Can it be the reserved memory swap? Or the dynamic kernel structures? The disk cache? Or the call to pstat_getprocvm() doesn't produce accurate results?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Mar 2003 15:19:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924313#M110207</guid>
      <dc:creator>Vladimir Tihu</dc:creator>
      <dc:date>2003-03-11T15:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924314#M110208</link>
      <description>Hi Vladimir,&lt;BR /&gt;&lt;BR /&gt;See attached file.&lt;BR /&gt;Change the script and change :&lt;BR /&gt;for i in `UNIX95= ps -e -o vsz=Kbytes -o ruser -o pid,args=Command-Line | sort -rnk1 | grep -v Kbytes`&lt;BR /&gt;do&lt;BR /&gt;print "$i"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regs David</description>
      <pubDate>Tue, 11 Mar 2003 15:29:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924314#M110208</guid>
      <dc:creator>David_246</dc:creator>
      <dc:date>2003-03-11T15:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924315#M110209</link>
      <description>Hi Vladimir,&lt;BR /&gt;&lt;BR /&gt;The pstat call is reporting the memory in user space (process usage). &lt;BR /&gt;&lt;BR /&gt;Swapinfo isn't an accurate way of measuring memory usage, the memory section actually refers to psuedo swap. &lt;BR /&gt;&lt;BR /&gt;Top will include system memory - the kernel data structures, kernel dynamic memory and the buffer cache etc, as you suspected.&lt;BR /&gt;&lt;BR /&gt;If you want to find out approximately how much system memory used:&lt;BR /&gt;&lt;BR /&gt;Use vmstat to find how much free memory pages you have. Subtract this from your physical memory (in pages)&lt;BR /&gt;&lt;BR /&gt;# echo phys_mem_pages/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}'&lt;BR /&gt;# vmstat 1 1|tail -1|awk '{print $5}'&lt;BR /&gt;&lt;BR /&gt;Find out how much buffer cache (pages) you are using:&lt;BR /&gt;&lt;BR /&gt;# echo bufpages/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}' &lt;BR /&gt;&lt;BR /&gt;So if you have already calculated process memory the system memory will be:&lt;BR /&gt;&lt;BR /&gt;used memory - (process memory) - (buffer cache)&lt;BR /&gt;&lt;BR /&gt;Obviously a lot easier if you have glance! :-) &lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;James.</description>
      <pubDate>Tue, 11 Mar 2003 15:49:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924315#M110209</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2003-03-11T15:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924316#M110210</link>
      <description>Ran the script and found 2034104 Kbytes reclaimed; so there is still a missing cca 2000Mb unexplained (the used column from swapinfo); on the other hand, the script adds the sizes of all text segments but, since these are shared, the real reclaimed space is less (we have a number of processes that share the same text segment).&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Mar 2003 15:50:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924316#M110210</guid>
      <dc:creator>Vladimir Tihu</dc:creator>
      <dc:date>2003-03-11T15:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924317#M110211</link>
      <description>&lt;BR /&gt; Hi James,&lt;BR /&gt;&lt;BR /&gt; Very useful commands, especially for finding the buffer cache size; seems that here resides the "lost" memory; I found that basically what top says it's free is what vmstat also reports and the difference (after including the process memory read with pstat call and eliminating duplicate text segments) is mainly this cache. Is there a way to find how the memory (pseudo) swap system handles memory (how much it reserves and uses)?&lt;BR /&gt;&lt;BR /&gt;  Thanks a lot&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Mar 2003 16:36:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924317#M110211</guid>
      <dc:creator>Vladimir Tihu</dc:creator>
      <dc:date>2003-03-11T16:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924318#M110212</link>
      <description>Hi Vladimir,&lt;BR /&gt;&lt;BR /&gt;The swapinfo command's "memory" section always leads to confusion! :-)&lt;BR /&gt;&lt;BR /&gt;This memory section is just a slight of hand hpux uses to make the VM system think it has more swap space than it actually has. All processes need to reserve swap space before they run in case they need to page (any!) part of the process out. To do this the kernel uses a counter. It decreases the counter when a process starts and requests VM. This is where the reserve field comes in. &lt;BR /&gt;&lt;BR /&gt;Consider an example. Using the old rule of thumb where swap=memory, on a 64GB system you would need 64GB disk space for swap. Bit of a waste as this server will probably be unlikely to page out in normal conditions. However, it may have to reserve massive amounts of the swap counter just to run. It we could take into account the physical memory the processes are occupying to increase this counter we could solve this problem, which is what psuedo swap does. &lt;BR /&gt;&lt;BR /&gt;The normal rule of thumb for this is 75% of available physical memory. It is also equal to the amount of lockable memory your system has.&lt;BR /&gt;&lt;BR /&gt;# dmesg|grep lockable&lt;BR /&gt;or&lt;BR /&gt;# echo lockable_mem/D|adb -k /stand/vmunix /dev/kmem&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;James.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 11 Mar 2003 17:17:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924318#M110212</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2003-03-11T17:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924319#M110213</link>
      <description>swapinfo includes swap area stats.&lt;BR /&gt;&lt;BR /&gt;             Kb      Kb      Kb   PCT  START/      Kb&lt;BR /&gt;TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME&lt;BR /&gt;dev     8388608       0 8388608    0%       0       -    1  /dev/vg00/lvol2&lt;BR /&gt;reserve       -  132316 -132316&lt;BR /&gt;memory  3169288  171332 2997956    5%&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That first line is my swap area, which is not used because the system isn't doing anything.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 11 Mar 2003 18:14:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924319#M110213</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-03-11T18:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924320#M110214</link>
      <description>Hi again Vladimir,&lt;BR /&gt;&lt;BR /&gt;Maybe that wasn't the best explanation, told you it could be confusing! If you're like me you may prefer the numbers in an example. I'll use my workstation and work through it.&lt;BR /&gt;&lt;BR /&gt;When the system starts up the swap space static counter swapspc_max is set to amount of device swap. The counter swapmem_max is set to the amount of psuedo swap.&lt;BR /&gt;&lt;BR /&gt;# echo swapspc_max/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}'&lt;BR /&gt; 131072&lt;BR /&gt;# echo swapmem_max/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}'&lt;BR /&gt; 95268&lt;BR /&gt;&lt;BR /&gt;So this indicates I have 512MB device swap and 372MB psuedo swap.&lt;BR /&gt;&lt;BR /&gt;Initially the dynamic counter swapsps_cnt is set to swapspc_max and swapmem_cnt is set to swapmem_max. Every time a process reserves swap space this amount is decremented from swapspc_cnt.&lt;BR /&gt;&lt;BR /&gt;# echo swapspc_cnt/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}'&lt;BR /&gt; 71505&lt;BR /&gt;&lt;BR /&gt;The way the swap is reserved the calculation for the swap in use is swapspc_max-(swapspc_max-swapspc_cnt), so from this we should have 281MB of swap in reserve.&lt;BR /&gt;&lt;BR /&gt;Also, pseudo swap is only used as a last resort, when swapspc_cnt=0.&lt;BR /&gt;&lt;BR /&gt;Lets check how this ties in with our swapinfo now:&lt;BR /&gt;&lt;BR /&gt;# swapinfo -tam&lt;BR /&gt;             Mb      Mb      Mb   PCT  START/      Mb&lt;BR /&gt;TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME&lt;BR /&gt;dev         512       0     512    0%       0       -    1  /dev/vg00/lvol2&lt;BR /&gt;reserve       -     214    -214&lt;BR /&gt;memory      372      67     305   18%&lt;BR /&gt;total       884     281     603   32%       -       0    -&lt;BR /&gt;&lt;BR /&gt;So, we do indeed have 512MB device swap and 372MB pseudo swap. However, our reserve is 67MB short and the memory field seems to have it. Why is this considering what I have said before?&lt;BR /&gt;&lt;BR /&gt;The 67MB is placed in the pseudo space field because it is already locked - it is the memory which cannot be paged (mainly system memory). So in effect it is already being used as pseudo swap would be if device swap was fully reserved.&lt;BR /&gt;&lt;BR /&gt;I hope this made more sense.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;James.</description>
      <pubDate>Tue, 11 Mar 2003 18:48:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924320#M110214</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2003-03-11T18:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924321#M110215</link>
      <description>Trying to figure out all the uses from memory in any Unix system is difficult. top's reports are the least useful. vmstat is a start but it doesn't give the whole picture. swapinfo shows reserved and actual usage plus pseudo swap assignments but not in an easy to read format.&lt;BR /&gt;&lt;BR /&gt;HP-UX has many other uses for RAM that are hard to count. As mentioned, the buffer cache (likely dynamic on your system) might occupy asa much as 50% of your RAM (not good usually) and extensive use of shared memeory segments, shared libraries and memory mapped files will also lead to unaccounted memory.&lt;BR /&gt;&lt;BR /&gt;About the only thigns you can control are the buffer cache size (kernel parameter) and application programs. And usually when sysadmins are asked about memory usage, it is due to a program that reports that it is out of memory. Unfortunately, out of memory is often a poor description of the real problem, either a kernel limit (maxdsiz or possibly maxssiz) or a user limit (ulimit). As long as you have a lot of swap, running out of memory is difficult.&lt;BR /&gt;&lt;BR /&gt;Check the white papers in /usr/share/doc for memory and process management and pay close attention to the severe restrictions for 32bit programs. Lots of systems have many Gb of RAM but 32bit programs cannot take advantage of large RAM except within their limited addressing space. Same with shared memory and 32bit programs.</description>
      <pubDate>Tue, 11 Mar 2003 18:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924321#M110215</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-03-11T18:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924322#M110216</link>
      <description>&lt;BR /&gt; Hi everybody,&lt;BR /&gt;&lt;BR /&gt; Sorry for the delay, I had to go to sleep!&lt;BR /&gt; I will read the documentation that you recommend.&lt;BR /&gt; For James, I must say the example started to enlighten me but I went check on my machine and noticed that swapspc_cnt is 1957260, swapspc_max is 2097152, swapinfo says reserve is 496Mb, memory used is 1176Mb, and the total dev used is 13Mb; so swapspc_max-swapspc_cnt is about 546Mb. I understand that the memory used means locked memory that doesn't have to be reserved for the process(es) but the rest of used memory? It must be system memory?&lt;BR /&gt;  I find all the explanations very useful.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot and best regards&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Mar 2003 10:27:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924322#M110216</guid>
      <dc:creator>Vladimir Tihu</dc:creator>
      <dc:date>2003-03-12T10:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924323#M110217</link>
      <description>Hi Vladimir,&lt;BR /&gt;&lt;BR /&gt;Please keep asking the questions, I'll try and explain more each time, there is a lot of variables as Bill mentioned!&lt;BR /&gt;&lt;BR /&gt;The important thing to remember is that the kernel is not a process and hence cannot reserve swap, either is the buffer cache and neither can be swapped out (bit simplistic but generally true) - they are fixed in memory. Hence they do not decrease the swapspc counters but the swapmem counters.&lt;BR /&gt;&lt;BR /&gt;I think the best way to show this is if I fill my buffer cache and show you the effect it has on the reserve and memory lines. I'll show the swapinfo output before and after.&lt;BR /&gt;&lt;BR /&gt;# swapinfo -tam|egrep "res|mem"&lt;BR /&gt;reserve       -     202    -202&lt;BR /&gt;memory      372      68     304   18%&lt;BR /&gt;&lt;BR /&gt;# echo bufpages/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}'&lt;BR /&gt; 10726&lt;BR /&gt;&lt;BR /&gt;# find / &amp;amp;&lt;BR /&gt;&lt;BR /&gt;(wait till this finishes)&lt;BR /&gt;&lt;BR /&gt;# echo bufpages/D|adb -k /stand/vmunix /dev/kmem|tail -1|awk -F: '{print $2}'&lt;BR /&gt; 22976&lt;BR /&gt;&lt;BR /&gt;# swapinfo -tam|egrep "res|mem"&lt;BR /&gt;reserve       -     205    -205&lt;BR /&gt;memory      372     183     189   49%&lt;BR /&gt;&lt;BR /&gt;So as you can see my memory field has increases a lot - simply due to the buffer cache increasing and adding to the locked memory in my system. As you have a large buffer cache this will be most of the count on your server too.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;James.</description>
      <pubDate>Wed, 12 Mar 2003 12:00:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924323#M110217</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2003-03-12T12:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924324#M110218</link>
      <description>&lt;BR /&gt;  Hello,&lt;BR /&gt;&lt;BR /&gt;  I found what I was looking for; James' notes esp. were of considerable help, they helped me understand what seemed to be in the dark and provided a valuable base for better tuning the systems.&lt;BR /&gt;  If it is not too much, for the moment I would like to ask just one more question:&lt;BR /&gt;James, in your "echos" you used standard input piped into adb -k /stand/vmunix...; these gives dynamic info (eg the swap dev counter, the count of free pages etc), but /stand/vmunix is a file on disk and it's timestamp is from when it was generated the last time, so where does this current info come from? Does adb go through memory mapped mechanism or some other way reads the system memory?&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt; &lt;BR /&gt;Vladimir</description>
      <pubDate>Thu, 13 Mar 2003 13:19:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924324#M110218</guid>
      <dc:creator>Vladimir Tihu</dc:creator>
      <dc:date>2003-03-13T13:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924325#M110219</link>
      <description>Hi Vladimir,&lt;BR /&gt;&lt;BR /&gt;Glad I could help, it is certainly not obvious what swapinfo reports a lot of the time!&lt;BR /&gt;&lt;BR /&gt;Adb is a debugger taking an object file and core file as arguments. In our case the kernel object (vmunix) is used and the core is kernel memory. The symbols we are using correspond to the entries in the symbol table of the vmunix object file, as it is not stripped. /dev/kmem is a pseudo driver for kernel memory access. We know these symbols will be in kernel memory as vmunix is loaded into memory when the system boots.&lt;BR /&gt;&lt;BR /&gt;If you want to check other symbols you can find the value of using adb run:&lt;BR /&gt;&lt;BR /&gt;# nm /stand/vmunix&lt;BR /&gt;or&lt;BR /&gt;# nm /stand/vmunix|awk -F\| '{print $8}'&lt;BR /&gt;&lt;BR /&gt;as the symbols are the last field. If you know q4 you can also use:&lt;BR /&gt;&lt;BR /&gt;q4&amp;gt; symbol &lt;PATTERN&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;James.&lt;BR /&gt;&lt;BR /&gt;&lt;/PATTERN&gt;</description>
      <pubDate>Thu, 13 Mar 2003 14:20:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924325#M110219</guid>
      <dc:creator>James Murtagh</dc:creator>
      <dc:date>2003-03-13T14:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Available Memory Info Problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924326#M110220</link>
      <description>&lt;BR /&gt;  Thanks for adb explanation (I didn't use debuggers on hpux until now preferred writing C programs when possible, but they seem to be very useful).&lt;BR /&gt;  Thanks James, thanks everybody.&lt;BR /&gt;  Now I'll go do some tcpip programming then I'll return to hpux.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Vladimir&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Mar 2003 09:28:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/available-memory-info-problem/m-p/2924326#M110220</guid>
      <dc:creator>Vladimir Tihu</dc:creator>
      <dc:date>2003-03-14T09:28:57Z</dc:date>
    </item>
  </channel>
</rss>

