2013年8月23日 星期五

紀錄一下/proc/pid/maps的使用

在跑起來的一支程式,可用cat /proc/pid/maps 來看他的memory layout
(似乎只看的到user space的)

以下是這段code看到的資訊:



  • address - The starting and ending address of the region in the process's address space
  • permissions - rwx就不用講了,p代表的是private(not shared),意義我也不懂@@
  • offset - Where the memory area begins in the file that it is mapped to. An offset of 0
    means that the beginning of the memory area corresponds to the beginning of
    the file.
  • device - If the region was mapped from a file, this is the major and minor device number (in hex) where the file lives.
  • inode - If the region was mapped from a file, this is the file number.
  • pathname - If the region was mapped from a file, this is the name of the file. This field is blank for anonymous mapped regions
reference : http://stackoverflow.com/questions/1401359/understanding-linux-proc-id-maps

其中這三個
應該是由上而下依序代表text(code) section, data section, BSS(uninitialization data) section

64bit的server上跑的@@
改天找個32bit machine跑對我來說比較容易

Related Posts:

  • Kernel Space MemoryReference : http://www.chudov.com/tmp/LinuxVM/html/understand/node28.html Kernel的virtual memory適用linear mapping,physical address 0對應到kernel virtual memory的PAGE_OFFSET(通常是0xC000_0000) 也就是說kernel virtual address - PAGE_OFFSET就… Read More
  • Memory zoneReference : Understaning the Linux Kernel Chap.8 Ideal computer architecture上,任意page frame都是可以被access的 但實際上的電腦架構在硬體上會有些限制住page frame被使用 Linux kernel must deal with two hardware constraints of the 80 × 86 architecture: • The D… Read More
  • Linux memory layout每一個user process看到的vitrual memory共有4G(32 bit machine) 其中通常切成3G:1G 0x00000000-0xbfffffff: user process(3GB) 0xc0000000-0xffffffff: kernel space (1GB) 而user process(3G)是每支user process不同的,甚至每支user thread也是不同    &… Read More
  • 紀錄一下/proc/pid/maps的使用在跑起來的一支程式,可用cat /proc/pid/maps 來看他的memory layout (似乎只看的到user space的) 以下是這段code看到的資訊: address - The starting and ending address of the region in the process's address space permissions - rwx就不用講了,p代表的是private(not shared),… Read More
  • Booting ARM system from bootloader to linux kernel有空來讀一下 會以u-boot code當作bootloader base 開到start_kernel之前的組語部分可以參考 http://gicl.cs.drexel.edu/people/sevy/linux/ARM_Linux_boot_sequence.html… Read More

0 意見:

張貼留言