Here I am running two instance of same program in two different terminals. The process map of them are
In first terminal -
vikram@vikram-Studio-XPS-1645:~$ pmap 6548
6548: ./a.out
0000000000400000 4K r-x-- /home/vikram/a.out
0000000000600000 4K r---- /home/vikram/a.out
0000000000601000 4K rw--- /home/vikram/a.out
00007f90f2406000 1576K r-x-- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f2590000 2044K ----- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f278f000 16K r---- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f2793000 4K rw--- /lib/x86_64-linux-gnu/libc-2.13.so
00007f90f2794000 24K rw--- [ anon ]
00007f90f279a000 132K r-x-- /lib/x86_64-linux-gnu/ld-2.13.so
00007f90f2992000 12K rw--- [ anon ]
00007f90f29b7000 12K rw--- [ anon ]
00007f90f29ba000 4K r---- /lib/x86_64-linux-gnu/ld-2.13.so
00007f90f29bb000 8K rw--- /lib/x86_64-linux-gnu/ld-2.13.so
00007fffb2333000 132K rw--- [ stack ]
00007fffb23ff000 4K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 3984K
In second terminal -
vikram@vikram-Studio-XPS-1645:~$ pmap 6676
6676: ./a.out
0000000000400000 4K r-x-- /home/vikram/a.out
0000000000600000 4K r---- /home/vikram/a.out
0000000000601000 4K rw--- /home/vikram/a.out
00007f3b0ad37000 1576K r-x-- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0aec1000 2044K ----- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0b0c0000 16K r---- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0b0c4000 4K rw--- /lib/x86_64-linux-gnu/libc-2.13.so
00007f3b0b0c5000 24K rw--- [ anon ]
00007f3b0b0cb000 132K r-x-- /lib/x86_64-linux-gnu/ld-2.13.so
00007f3b0b2c3000 12K rw--- [ anon ]
00007f3b0b2e8000 12K rw--- [ anon ]
00007f3b0b2eb000 4K r---- /lib/x86_64-linux-gnu/ld-2.13.so
00007f3b0b2ec000 8K rw--- /lib/x86_64-linux-gnu/ld-2.13.so
00007fffb1153000 132K rw--- [ stack ]
00007fffb11c7000 4K r-x-- [ anon ]
ffffffffff600000 4K r-x-- [ anon ]
total 3984K
My questions are -
"/lib/x86_64-linux-gnu/ld-2.13.so" this library has two different addresses in terminal 1 and 2 ( 00007f90f279a000 and 00007f3b0b0cb000 ). Is it means this library is loaded 2 times in main memory ?
Assuming a.out is binary of simple Hello_World.c program
#include<stdio.h> void main() { printf("Hello World");}
then which part of a.out has r & w permission ? In simple words which part of source " 0000000000601000 4K rw--- /home/vikram/a.out " this segment is suppose to contain ?
Why anon is not continuous like other segments ?
What " 00007f90f2590000 2044K ----- /lib/x86_64-linux-gnu/libc-2.13.so " this segment suppose to contain .... because it doesn't have read, write, execute permissions.