HP-UX操作系统的内存

HP-UX操作系统的内存使用:
(1) 内核                       无命令可查看大小
(2) 进程(包括核心进程)       top -d1 -n1 -s1;export UNIX95=1;ps -eopid,sz,vsz,comm,args
(3) 设备的缓存:BUFFER         无命令可查看大小
(4) 设备文件缓冲:CACHE        无命令可查看大小
(5) 页面调度                   swapinfo
(6) 空闲内存                   top -d1 -n1 -s1;


“export UNIX95=1;ps -epid,sz,vsz,comm”命令查看的SZ总和,VSZ总和与top命令的
活动的进程内存、进程的虚存 基本相同。

 

■ 内存使用率的计算问题

参照LINUX的内存使用率计算公式,BUFFER、CACHE被认为是空闲的,内存使用率的计算公式为:

 

      内存使用率 = 1 - (free + CACHE + BUFFER)/ 物理内存大小

 

当HP-UX操作系统之上有数据库系统等大型应用进行大量的文件IO操作(包括网络SOCKET)时,
HP-UX操作系统为了提高设备及文件的IO效率,将会把大量的内存用于CACHE、BUFFE。这样从OS角度
看的空闲内存就比较小了。

 

CACHE、BUFFER的大小在HP-UX下没办法获取,假定为0,自然计算出的内存使用率就偏高了。


按照HP工程师的说法,如果 基于设备或文件系统的 SWAP使用率为0,即使内存使用率接近100%,
也不能说明内存不够用。


在某些情况下,虽然top看到还有空闲内存,但由于HP-UX的内存管理机制(下述的内存请求的预定),
有可能出现进程请求内存或启动进程时,由于可以用于 页面调度的剩余空间 不能满足 请求空间预定
的 要求而被拒绝,这时从应用角度看 就会出现 内存不够 或 进程启动不了的情况了。在发生这种情
况时,应该加大SWAP空间,以满足OS对 页面调度空间的 预定需求。

 

进程预定的SWAP空间,只有在真正发生页面交换(swap)时,才会被使用。请看下述的 HP-UX对swapinfo
的信息解释 。

 

■ swapinfo对 页面调度 分配 的解释

swapinfo命令的样本:
$ swapinfo
             Kb      Kb      Kb   PCT START/      Kb
TYPE      AVAIL    USED    FREE USED   LIMIT RESERVE PRI NAME
dev     1048576       0 1048576    0%       0       -    1 /dev/vg00/lvol2
reserve       - 368628 -368628
memory   747268 455972 291296   61%

 

swapinfo命令的在线手册查看命令:
$ man swapinfo

 

HP-UX系统命令“swapinfo”在线帮助关于 页面调度 的部分内容含义:
(paging:内存分页、页面调度)

 

dev        Paging space residing on a mass storage device,
           either taking up the entire device or, if the
           device contains a file system, taking up the
           space between the end of the file system and
           the end of the device. This space is
           exclusively reserved for paging, and even if it
           is not being used for paging, it cannot be used
           for any other purpose. Device paging areas
           typically provide the fastest paging.

 

设备       在一个块存储设备上的页面调度空间,或占用整个设备,或如果设备包含一个文件
           系统,则占用在文件系统末端与设备末端间的空间。该空间被排他地保留为页面调
           度,该空间不能用于任何其它目的。设备页面调度区域提供快速的页面调度。

 

fs         Dynamic paging space available from a file
           system. When this space is needed, the system
           creates files in the file system and uses them
           as paging space. File system paging is
           typically slower than device paging, but allows
           the space to be used for other things (user
           files) when not needed for paging.

 

文件系统   在一个文件系统上的可用的动态页面调度空间。但这个空间被需要,系统在文件
           系统上创建文件并将其用于页面调度空间。文件系统页面调度比设备页面调度慢,
           但不需要用于页面调度时,允许这些空间用于其它事情(用户文件)。

 

localfs    File system paging space (see fs above) on a
           file system residing on a local disk.

 

本地文件系统 在一个本地磁盘上的文件系统的 文件系统的页面调度空间(见上述的fs)。

 

network    File system paging space (see fs above) on a
           file system residing on another machine. This
           file system would have been mounted on the
           local machine via NFS.

 

网络       在另一台机器的一个文件系统上的文件系统的页面调度空间(见上述的fs)。这个文件
           系统在本地机器通过NFS挂接。

 

reserve    Paging space on reserve. This is the amount of
           paging space that could be needed by processes
           that are currently running, but that has not
           yet been allocated from one of the above paging
           areas. See "Paging Allocation" below.

 

预订       被预订的页面调度空间。当前正在运行的所有进程可能需要
           的页面调度空间总量,但还没有在上述的页面调度区域被分配。
           请看后述的“内存分页分配”。

 

memory     Memory paging area (also known as pseudo-swap).
           This is the amount of system memory that can be
           used to hold pages in the event that all of the
           above paging areas are used up. See "Paging
           Allocation" below. This line appears only if
           memory paging is enabled.

 

内存       内存页面调度区域(也称作 伪交换区)。在上述所有页面调度
           区域被用完时,存放页面的的系统内存总量。请看后述的
          “页面调度分配”。仅当 内存页面调度激活下才出现。

 

Paging Allocation
内存分页分配

 

      Paging areas are enabled at boot time (for device paging areas
      configured into the kernel) or by the swapon command (see swapon(1M)),
      often invoked by /sbin/init.d/swap_start during system initialization
      based on the contents of /etc/fstab. When a paging area is enabled,
      some portion of that area is allocated for paging space. For device
      paging areas, the entire device is allocated, less any leftover
      fraction of an allocation chunk. (The size of an allocation chunk is
      controlled by the tunable parameter swchunk, and is typically 2 MB.)
      For file system paging areas, the minimum value given to swapon
      (rounded up to the nearest allocation chunk) is allocated.

 

      页面调度区域在启动时被激活(配置于内核的设备页面调度区域) 或者 用swapon命
      令(请看swapon在1M节的手册,即用“man 1M swapon” 命令行来查看),在基于
      “/etc/fstab”内容的系统初始化期间swapon命令经常被“/sbin/init.d/swap_start”
      调用。但一个页面调度区域被激活时,该区域的某些部分被分配用于页面调度空间。
      基于设备的页面调取区域,除了少量的不够一个分配块的多余碎片外,整个设
      备将被分配(一个可分配块的大小由可调整的参数swchunk控制,并且典型块大小为2M);
      基于文件系统的页面调取区域,按照swapon命令指定的最小值(被调整到<rounded>最近
      的分配块)来分配。

 

      When a process is created, or requests additional space, space is
      reserved for it by increasing the space shown on the reserve line
      above. When paging activity actually occurs, space is used in one of
      the paging areas (the one with the lowest priority number that has
      free space available, already allocated), and that space will be shown
      as used in that area.

 

      当一个进程被创建或请求额外的空间时,通过 增加 上述预定行的空间,请求的空间
      被预定。当页面调度活动真正发生时,页面调度区域之一(有空闲可用空间的最低优
      先号的那个,已分配的)的空间被使用,并且那个空间将作为已使用被显示。

 

      The sum of the space used in all of the paging areas, plus the amount
      of space reserved, can never exceed the total amount allocated in all
      of the paging areas. If a request for more memory occurs which would
      cause this to happen, the system tries several options:

 

      所有页面调度区域已使用空间的总和,加上被预定的空间总量,永远不会超出所有页面
      调度区域已分配的总量。如果发生需要更多内存,可能引起这种情况发生的请求,系统
      尝试几种选择:

 

      1.   The system tries to increase the total space available by
           allocating more space in file system paging areas.

 

           系统尝试 用在文件系统的页面调度区域分配更多空间的办法增加总的可用空间。

 

      2.   If all file system paging areas are completely allocated and the
           request is still not satisfied, the system will try to use memory
           paging as described on the memory line above. (Memory paging is
           controlled by the tunable parameter swapmem_on, which defaults to
           1 (on). If this parameter is turned off, the memory line will
           not appear.)

 

          如果所有文件系统的页面调度区域完全分配但请求还不能满足,系统将尝试用上
          述“内存”行描述的内存页面调度。(内存页面调度有可调整的参数swapmem_on控
          制,缺省为1(on)。如果该参数被关闭,那个“内存”行将不出现)

 

      3.   If memory paging also cannot satisfy the request, because it is
           full or turned off, the request is denied.

 

           如果内存页面调度也不能满足请求,由于其已满(用完)或被关闭,该请求被拒绝。

 

      Several implications of this procedure are noteworthy for
      understanding the output of swapinfo:

 

      为理解swapinfo输出,这个过程的几个含义值得注意:     

 

      +    Paging space will not be allocated in a file system paging area
           (except for the minimum specified when the area is first enabled)
           until all device paging space has been reserved, even if the file
           system paging area has a lower priority value.

 

           在文件系统的页面调度区域,页面调度空间将不被分配(除非当该区域首次激活时
           指定了最小值),除非所有设备的页面设备度空间已被预订,即使文件系统的页面
           调度区域有更低优先值。

 

      +    When paging space is allocated to a file system paging area, that
           space becomes unavailable for user files, even if there is no
           paging activity to it.
           
           但页面调度空间被分配在一个文件系统的页面调度区域时,那个空间成为用户文件
           不可用空间,即使在那个空间没有页面调度活动。

 

      +    Requests for more paging space will fail when they cannot be
           satisfied by reserving device, file system, or memory paging,
           even if some of the reserved paging space is not yet in use.
           Thus it is possible for requests for more paging space to be
           denied when some, or even all, of the paging areas show zero
           usage - space in those areas is completely reserved.

 

           预留在设备、文件系统或内存的页面调度空间 不能满足 需要更多页面调度空间的请
           求时,这些请求将失败,即使某些预定页面调度空间还没使用。因此,当某些或所有
           页面调度区域显示0使用率——这些区域的空间被完全预定时,有可能发生需要更多页
           面调度空间的请求被拒绝,
         
      +    System available memory is shared between the paging subsystem
           and kernel memory allocators. Thus, the system may show memory
           paging usage before all available disk paging space is completely
           reserved or fully allocated.

 

           在页面调度子系统和内核内存分配器间,系统可用内存被共享。如此,在所有可用的
           磁盘页面调度空间被全部预定或完全分配之前,系统显示基于内存的页面调度空间使
           用率。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值