I have seen the following script:
$ ./crazy-malloc &
[1] 2817
malloced 3056 MB
$ jobs -x pmap %1
2823: ./crazy-malloc
000cc000 4112K rw--- [ anon ]
004d0000 104K r-x-- /lib/ld-2.3.5.so
004ea000 4K r---- /lib/ld-2.3.5.so
004eb000 4K rw--- /lib/ld-2.3.5.so
004ee000 1168K r-x-- /lib/libc-2.3.5.so
00612000 8K r---- /lib/libc-2.3.5.so
00614000 8K rw--- /lib/libc-2.3.5.so
00616000 8K rw--- [ anon ]
006cf000 124388K rw--- [ anon ]
08048000 4K r-x-- /home/john/examples/mm/crazy-malloc
08049000 4K rw--- /home/john/examples/mm/crazy-malloc
08051000 2882516K rw--- [ anon ]
b7f56000 125424K rw--- [ anon ]
bfa43000 84K rw--- [ stack ]
bfa58000 5140K rw--- [ anon ]
ffffe000 4K ----- [ anon ]
total 3142980K
Q1> what is the usage of the line jobs -x pmap %1? What does %1 indicate here?
jobs -x command [ args … ] If the -x option is supplied, jobs
replaces any jobspec found in command or args with the corre-sponding
process group ID, and executes command passing it args, returning its
exit status.pmap – report memory map of a process
Q2> What the first two columns represent?
%1represents the process which you just started and backgrounded (./crazy-malloc, pid 2817). The commandjobs -x pmap %1expands topmap 2817.The four columns in the output of
pmaprepresent, respectively, the base address, size, permissions, and mapped file for each memory region mapped by your process.