Memory Management - Kind of Related to Device Files

   

HP-UX Virtual Partitions
By Marty Poniatowski

Table of Contents
Chapter 5.  Virtual Partitions and Devices


Memory-related topics are almost never covered in system administration discussion. This is because memory is in too many different forms and there are too many factors affecting how much memory you need, what kind of memory you need, and so on. Let's cover some memory-related topics at a high level and look at some commands related to memory.

To begin with, most memory discussions begin with: what is swap, and how much do I need? HP-UX system administrators spend a lot of time worrying about swap. It must be very important. Swap is one part of the overall HP-UX memory management scheme, one of three parts to be exact. As any student of computer science will tell you, computers have three types of memory: cache memory, Random Access Memory (RAM), and disk memory. These are listed in order of their speed; that is, cache is much faster than RAM, which is much faster than disk.

Cache Memory

The HP Precision Architecture chip-set is configured with both data and instruction cache, which, I might add, are used very efficiently. You must rely on the operating system to use cache efficiently, since you have very little control over this. If you need information from memory and it is loaded in cache (probably because you recently accessed this information or accessed some information that is located close to what you now want), it will take very little time to get the information out of cache memory. This access, called a cache "hit," is instantaneous for all practical purposes. One of the reasons cache memory is so fast is that it typically is physically on the same chip as the processor. If putting large amounts of cache on-chip with the processor were possible, this would obviate the need for RAM and disk. This, however, is not currently possible, so efficient use of memory is a key to good overall system performance.

Checking Available RAM

Your system spells out to you what RAM is available. /sbin/dmesg gives you the amount of "physical" memory installed on the system, as shown below for a 64-MByte system:

 Physical: 65536 Kbytes 

Don't get too excited when you see this number, because it is not all "available" memory. Available memory is what is leftover after some memory is reserved for kernel code and data structures. You'll also see the available memory, in this case approximately 54 MBytes, with /sbin/dmesg:

 available: 55336 Kbytes 

Some of the available memory can also be "lockable." Lockable memory is that which can be devoted to frequently accessed programs and data. The programs and data that lock memory for execution will remain memory-resident and run more quickly. You will also see the amount of lockable memory, in this case approximately 44 MBytes, at the time of system startup:

 lockable: 45228 

/sbin/dmesg shows you these values and a summary of system-related messages. You should issue this command on your system to see what it supplies you. The following displays the output of both bdf and the /sbin/ dmesg command issued on a large V-Class system with an XP 256 disk array unit attached toit.

 # bdf  Filesystem         kbytes    used   avail %used Mounted on  /dev/vg00/lvol3    524288   40899  453231    8% /  /dev/vg00/lvol1     99669   29984   59718   33% /stand  /dev/vg00/lvol7   1048576  272706  728019   27% /var  /dev/vg00/lvol6   1048576  491445  522318   48% /usr  /dev/vgu10/lvol1  35860480   35632 35544976    0% /u10  /dev/vgu09/lvol1  35860480 4358224 31256152   12% /u09  /dev/vgu08/lvol1  35860480   21560 35576720    0% /u08  /dev/vgu07/lvol1  35860480  555544 35029128    2% /u07  /dev/vgu06/lvol1  35860480   13624 35566816    0% /u06  /dev/vgu05/lvol1  35860480  560432 35024280    2% /u05  /dev/vgu04/lvol1  35860480  575152 35009672    2% /u04  /dev/vgu03/lvol1  35860480   13624 35566816    0% /u03  /dev/vgu02/lvol1  35860480   13632 35566808    0% /u02  /dev/vgu01/lvol1  35860480 5611848 30012328   16% /u01  /dev/vg00/lvol5    204800    2273  189930    1% /tmp  /dev/vg00/lvol4   2097152  466824 1528479   23% opt  /dev/vg00/lvol8    524288    2887  488858    1% /home  /dev/vgapp/lvol1  35860480 6485880 29146160   18% /app  # /sbin/dmesg  Jun 20 16:26  ...  disk  5/0/0.8.0.0.0.9.2 sdisk  5/0/0.8.0.0.0.9.3 sdisk  5/0/0.8.0.0.0.9.4 sdisk  5/0/0.8.0.0.0.9.5 sdisk  5/0/0.8.0.0.0.9.6 sdisk  5/0/0.8.0.0.0.9.7 sdisk  5/0/0.8.0.0.0.10 tgt  5/0/0.8.0.0.0.10.0 sdisk  5/0/0.8.0.0.0.10.1 sdisk  5/0/0.8.0.0.0.10.2 sdisk  5/0/0.8.0.0.0.10.3 sdisk  5/0/0.8.0.0.0.10.4 sdisk  5/0/0.8.0.0.0.10.5 sdisk  5/0/0.8.0.0.0.11 tgt  5/0/0.8.0.0.0.11.0 sdisk  5/0/0.8.0.0.0.12 tgt  5/0/0.8.0.0.0.12.0 sdisk  5/0/0.8.0.0.0.13 tgt  5/0/0.8.0.0.0.13.0 sdisk  5/0/0.8.0.0.0.14 tgt  5/0/0.8.0.0.0.14.0 sdisk  5/0/0.8.0.255.0 fcpdev  5/0/0.8.0.255.0.0 tgt  5/0/0.8.0.255.0.0.0 sctl  Probing epic6  Probe of epic6 complete  6 saga  6/0/0 btlan6  Probing epic7  Probe of epic7 complete  7 saga  7/0/0 td  td: claimed Tachyon TL/TS Fibre Channel Mass Storage card at 7/0/0  7/0/0.8 fcp  7/0/0.8.0.0.0 fcparray  7/0/0.8.0.0.0.0 tgt  7/0/0.8.0.0.0.0.0 sdisk  7/0/0.8.0.0.0.0.1 sdisk  7/0/0.8.0.0.0.0.2 sdisk  7/0/0.8.0.0.0.0.3 sdisk  7/0/0.8.0.0.0.0.4 sdisk  7/0/0.8.0.0.0.0.5 sdisk  7/0/0.8.0.0.0.0.6 sdisk  7/0/0.8.0.0.0.0.7 sdisk  7/0/0.8.0.0.0.1 tgt  7/0/0.8.0.0.0.1.0 sdisk  7/0/0.8.0.0.0.1.1 sdisk  7/0/0.8.0.0.0.1.2 sdisk  7/0/0.8.0.0.0.1.3 sdisk  7/0/0.8.0.0.0.1.4 sdisk  7/0/0.8.0.0.0.1.5 sdisk  7/0/0.8.0.0.0.1.6 sdisk  7/0/0.8.0.0.0.1.7 sdisk  7/0/0.8.0.0.0.2 tgt  7/0/0.8.0.0.0.2.0 sdisk  7/0/0.8.0.0.0.2.1 sdisk  7/0/0.8.0.0.0.3 tgt  7/0/0.8.0.0.0.3.0 sdisk  7/0/0.8.0.0.0.4 tgt  7/0/0.8.0.0.0.4.0 sdisk  7/0/0.8.0.0.0.5 tgt  7/0/0.8.0.0.0.5.0 sdisk  7/0/0.8.0.0.0.6 tgt  7/0/0.8.0.0.0.6.0 sdisk  7/0/0.8.0.0.0.7 tgt  7/0/0.8.0.0.0.7.0 sdisk  7/0/0.8.0.0.0.8 tgt  7/0/0.8.0.0.0.8.0 sdisk  7/0/0.8.0.0.0.8.1 sdisk  7/0/0.8.0.0.0.8.2 sdisk  7/0/0.8.0.0.0.8.3 sdisk  7/0/0.8.0.0.0.8.4 sdisk  7/0/0.8.0.0.0.8.5 sdisk  7/0/0.8.0.0.0.8.6 sdisk  7/0/0.8.0.0.0.8.7 sdisk  7/0/0.8.0.0.0.9 tgt  7/0/0.8.0.0.0.9.0 sdisk  7/0/0.8.0.0.0.9.1 sdisk  7/0/0.8.0.0.0.9.2 sdisk  7/0/0.8.0.0.0.9.3 sdisk  7/0/0.8.0.0.0.9.4 sdisk  7/0/0.8.0.0.0.9.5 sdisk  7/0/0.8.0.0.0.9.6 sdisk  7/0/0.8.0.0.0.9.7 sdisk  7/0/0.8.0.0.0.10 tgt  7/0/0.8.0.0.0.10.0 sdisk  7/0/0.8.0.0.0.10.1 sdisk  7/0/0.8.0.0.0.11 tgt  7/0/0.8.0.0.0.11.0 sdisk  7/0/0.8.0.0.0.12 tgt  7/0/0.8.0.0.0.12.0 sdisk  7/0/0.8.0.0.0.13 tgt  7/0/0.8.0.0.0.13.0 sdisk  7/0/0.8.0.0.0.14 tgt  7/0/0.8.0.0.0.14.0 sdisk  7/0/0.8.0.255.0 fcpdev  7/0/0.8.0.255.0.0 tgt  7/0/0.8.0.255.0.0.0 sctl  8 memory  15 bus_adapter  15/1 consp1  15/2 consp1  16 processor  18 processor  21 processor  23 processor  24 processor  26 processor  29 processor  32 processor  34 processor  37 processor  39 processor  40 processor  42 processor  45 processor  btlan6: Initializing 10/100BASE-TX card at 0/0/0....  btlan6: Initializing 10/100BASE-TX card at 6/0/0....  System Console is on SPP DUART0 Interface  Entering cifs_init...  Initialization finished successfully... slot is 8  Logical volume 64, 0x3 configured as ROOT  Logical volume 64, 0x2 configured as SWAP  Logical volume 64, 0x2 configured as DUMP      Swap device table: (start & size given in 512-byte blocks)          entry0-major is 64, minor is 0x2; start = 0, size = 2097152      Dump device table: (start & size given in 1-Kbyte  blocks)          entry0-major is 31, minor is 0x6000; start = 105312, size = 1048576  Starting the STREAMS daemons-phase 1  btlan6: NOTE: MII Link Status Not OK - Switch Connection to AUI at 0/0/0....  Create STCP device files  Starting the STREAMS daemons-phase 2      B2352B/9245XB HP-UX (B.11.00) #1: Wed Nov 5 22:38:19 PST 1997  Memory Information:      physical page size = 4096 bytes, logical page size = 4096 bytes      Physical: 16773120 Kbytes, lockable: 13099368 Kbytes, available: 15031616 Ks  btlan6: timeout: DMA timeout occurred at 0/0/0  btlan6: reset state is 550 at 0/0/0....  btlan6: WARNING: AUI Loopback Failed at 0/0/0....  btlan6: timeout: DMA timeout occurred at 0/0/0  btlan6: reset state is 575 at 0/0/0....  btlan6: WARNING: BNC Loopback Failed at 0/0/0....  Unable to add all swap for device: /dev/vg00/lvol9. Increase the tunable parame.  # 

As you can see, dmesg provides a lot of useful information in addition to the memory-related reporting we earlier covered. The memory information in this output is roughly 1.6 GBytes total and 1.3 GBytes lockable.

Managing Cache and RAM

If the information you need is not in cache memory but in RAM, then the access will take longer. The speed of all memory is increasing and RAM speed is increasing at a particularly rapid rate. You have a lot of control over the way in which RAM is used. First, you can decide how much RAM is configured into your system. The entire HP product line, both workstations and server systems, supports more RAM than you will need in the system. RAM, at the time of this writing, is inexpensive and getting less expensive all the time. RAM is not a good area in which to cut corners in the configuration of your system. Moreover, you can use whatever RAM you have configured efficiently. One example is in configuring an HP-UX kernel that is efficient. The HP-UX kernel is always loaded in RAM. This means that if it is 2 or 3 MBytes too big for your needs, then this is 2 or 3 MBytes you don't have for other purposes. If you need to access some information in RAM, it will take roughly one order of magnitude longer to access than if it were in cache.

Virtual Memory

If your system had only cache and, say, 64 MBytes of RAM, then you would be able to have user processes that consumed only about 64 MBytes of physical memory. With memory management, you can have user processes that far exceed the size of physical memory by using virtual memory. Virtual memory allows you to load into RAM only parts of a process while keeping the balance on disk. You move blocks of data back and forth between memory and disk in pages.

Swap

Swap is used to extend the size of memory, that is, reserve an area on the disk to act as an extension to RAM. When the load on the system is high, swap space is used for part or all of the processes for which space is not available in physical memory. HP-UX handles all this swapping for you with the vhand, statdaemon, and swapper processes. You want to make sure that you have more than enough swap space reserved on your disk so that memory management can take place without running out of swap space.

Three types of swap space exist: primary swap, secondary swap, and filesystem swap. These are described next:

Primary swap

Swap that is available at boot. Primary swap is located on the same disk as the root file system. If a problem occurs with this primary swap, you may have a hard time getting the system to boot.

Secondary swap

Swap that is located on a disk other than the root disk.

File system swap

This is a file system that supports both files and data structures as well as swapping.

Don't labor too much over the amount of swap to configure. At a minimum, swap should be twice the size of physical memory (this is the installation process default size). Also, our primary applications will define the amount of swap required. Most of the applications I've worked with make clear the maximum amount of swap required for the application. If you are running several applications, add together the swap required for each application if they are going to be running simultaneously.


       
    Top
     



    HP-UX Virtual Partitions
    HP-UX Virtual Partitions
    ISBN: 0130352128
    EAN: 2147483647
    Year: 2002
    Pages: 181

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net