进程地址转换 ---图

Mapping virtual addresses(x86)

1.由于线性地址非常广,逐一查找非常慢,才用三级页表,索引查找

2.TLB:Transfer lookaside buffer(存储地址映射关系)
    1.cpu--->tlb (大页bigpage:提高TLB 命中,也可以提高分配效益)
    2.cpu----mmu----页框

 

3.缺页异常:

   major:

     已经建立关系,但数据不在内存,在硬盘上,或者 SWAP

   minor:

    一个进程访问内存中已存的数据(共享库 代码库),然后再映射

   每个进程的地址映表:在进程的 task struct中

 

 

 

 

     虚拟化:

   os --->vm---->进程

:1。04

 

 

物理地址空间:

ZONE_NORMAL:内核直接访问

32位系统LINUX系统,对高地址房问必须转换

128M Reserverd for kernel data structures :地址映射表,因为32内核只能访问1G的物理空间

linux 内核占1G

 

[root@monitor 26774]# cat statm
58196 2043 1012 84 0 974 0
[root@monitor 26774]# pwd
/proc/26774

The columns are:
size       total program size
resident   resident set size
share      shared pages
text        text (code)
lib           library
data       data/stack
dt          dirty pages (unused in Linux 2.6)
页面单位 :*4K
 
disk:(IO密集)
PI:读到内存
po:写到磁盘
 
swap: (内存不足)
si:读到内存
so:写到SWAP
[root@monitor 26774]# sar -r 1
Linux 2.6.32-431.23.3.el6.x86_64 (monitor)      06/10/2016      _x86_64_        (1 CPU)

05:59:07 PM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
05:59:08 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:09 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:10 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:11 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:12 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:13 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:14 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:15 PM    491988    526612     51.70     22276    397204    305836     30.03
05:59:16 PM    491988    526612     51.70     22276    397204    305836     30.03
[root@monitor 26774]# vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 489732  22312 397464    0    0     5   117  126  120  2  1 97  0  0
 0  0      0 489724  22312 397464    0    0     0     0   90  262  0  0 100  0  0
 0  0      0 489724  22312 397464    0    0     0     0   97  278  1  0 99  0  0
 0  0      0 489724  22312 397464    0    0     0     0  104  266  0  0 100  0  0
 0  0      0 489732  22312 397464    0    0     0     0   98  272  0  0 100  0  0

 

[root@monitor 26774]# sar -R 1
Linux 2.6.32-431.23.3.el6.x86_64 (monitor)      06/10/2016      _x86_64_        (1 CPU)

06:01:27 PM   frmpg/s   bufpg/s   campg/s
06:01:28 PM     -4.00      0.00      0.00
06:01:29 PM      0.00      0.00      0.00
06:01:30 PM      0.00      0.00      0.00
06:01:31 PM      0.00      0.00      0.00
06:01:32 PM      0.00      0.00      0.00

 

[root@monitor 26774]# dstat -vm
Terminal width too small, trimming output.
---procs--- ------memory-usage----- ---paging-- -dsk/total- ---system-- ----total-cpu-usage---->
run blk new| used  buff  cach  free|  in   out | read  writ| int   csw |usr sys idl wai hiq siq>
  0   0 0.1| 110M 21.9M  388M  474M|   0     0 |9580B  232k| 126   278 |  2   1  97   0   0   0>
  0   0   0| 110M 21.9M  388M  474M|   0     0 |   0     0 | 132   302 |  0   1  99   0   0   0>
  0   0   0| 110M 21.9M  388M  474M|   0     0 |   0     0 | 118   291 |  0   0 100   0   0   0>
  0   0   0| 110M 21.9M  388M  474M|   0     0 |   0     0 | 125   298 |  1   0  99   0   0   0>
  0   0   0| 110M 21.9M  388M  474M|   0     0 |   0     0 | 115   290 |  0   0 100   0   0   0>
  0   0   0| 110M 21.9M  388M  474M|   0     0 |   0     0 | 116   293 |  0   0 100   0   0   0>^C

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

posted @ 2016-06-10 17:35  zengkefu  阅读(446)  评论(0编辑  收藏  举报