<br>
<br><div class="gmail_quote">On Tue, Mar 19, 2013 at 8:27 PM, Mulyadi Santosa <span dir="ltr"><<a href="mailto:mulyadi.santosa@gmail.com" target="_blank">mulyadi.santosa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Niroj....<br>
<br>
Please see inlined answer below...<br>
<div><br>
On Mon, Mar 18, 2013 at 5:28 PM, Niroj Pokhrel <<a href="mailto:nirojpokhrel@gmail.com" target="_blank">nirojpokhrel@gmail.com</a>> wrote:<br>
> Hi all,<br>
> As I have read, whenever we execute a program, the memory is allocated in<br>
> different sections viz stack, text and data segment.<br>
<br>
</div>Yup, that is correct<br>
<div><br>
> But, since we have used<br>
> loader and linker the three allocations will happen for them too.<br>
<br>
</div>Correct again. Linker and loader will be the part of process address space.<br>
<div><br>
> But when I ran a program and did pmap pid, I saw several other fields which<br>
> I have no idea of. What is the [anon] and what is it doing here ?<br>
<br>
</div>Anon is short of anonymous. It is a region of memory created by<br>
function e.g malloc() or mmap()<br>
<div><br>
>Why the<br>
> memory is being implemented for it and there are so many of them ?<br>
<br>
</div>Drawing from above explanation, we can easily conclude somewhere in<br>
the program, it does malloc() or mmap().<br>
<div><br>
> And also the stack ( 3rd last element), is it the process stack??<br>
<br>
</div>Yes, it's process' stack<br>
<div><br>
>Can<br>
> somebody please explain.<br>
> Thanking you all in advance.<br>
><br>
> 5448: ./a.out<br>
> 0000000000400000 4K r-x-- /home/n.pokhrel/Personal/mywork/a.out<br>
> 0000000000600000 4K r---- /home/n.pokhrel/Personal/mywork/a.out<br>
> 0000000000601000 4K rw--- /home/n.pokhrel/Personal/mywork/a.out<br>
> 00007f57f5e18000 1512K r-x-- /lib/<a href="http://libc-2.11.1.so" target="_blank">libc-2.11.1.so</a><br>
> 00007f57f5f92000 2044K ----- /lib/<a href="http://libc-2.11.1.so" target="_blank">libc-2.11.1.so</a><br>
> 00007f57f6191000 16K r---- /lib/<a href="http://libc-2.11.1.so" target="_blank">libc-2.11.1.so</a><br>
> 00007f57f6195000 4K rw--- /lib/<a href="http://libc-2.11.1.so" target="_blank">libc-2.11.1.so</a><br>
> 00007f57f6196000 20K rw--- [ anon ]<br>
> 00007f57f619b000 128K r-x-- /lib/<a href="http://ld-2.11.1.so" target="_blank">ld-2.11.1.so</a><br>
> 00007f57f6396000 12K rw--- [ anon ]<br>
> 00007f57f63b8000 8K rw--- [ anon ]<br>
> 00007f57f63ba000 4K r---- /lib/<a href="http://ld-2.11.1.so" target="_blank">ld-2.11.1.so</a><br>
> 00007f57f63bb000 4K rw--- /lib/<a href="http://ld-2.11.1.so" target="_blank">ld-2.11.1.so</a><br>
> 00007f57f63bc000 4K rw--- [ anon ]<br>
> 00007fffa2f37000 84K rw--- [ stack ]<br>
<br>
> 00007fffa2fa0000 4K r-x-- [ anon ]<br>
> ffffffffff600000 4K r-x-- [ anon ]<br>
<br>
</div>ok, one of the region above, I think it's VDSO (virtual dynamic shared<br>
object). It's a region that handle system call. When a process does<br>
system call, it jumps to VDSO, and it is the VDSO that does the<br>
actuall syscall<br>
<span><font color="#888888"><br>
--<br>
regards,<br>
<br>
Mulyadi Santosa<br>
Freelance Linux trainer and consultant<br>
<br>
blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>
training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a><br>
</font></span></blockquote></div><br><br><br>Hi Mulyadi .<br>Thank you very much.... But I still have a minor confusion .........<br>All I ran was this short program<br><br>#include<stdio.h><br>int main()<br>{<br> while(1)<br>
{<br> }<br> return 0;<br>}<br><br>I
don't understand where does mmap or malloc come in to play in this
code. It would be great if you can give me some insight.<br>Thanking you in advance.<br><br>Yours,<br>Niroj Pokhrel<br><br>