Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
842 views
in Technique[技术] by (71.8m points)

unix - Where is the stack memory allocated from for a Linux process?

We know that when a process is created,one stack is allocated for this process.The size of the stack is typically 8 Mb in linux.My question is that,from where this stack is allocated??From user space or from system space?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I hope you know the concept that all user process will be kept in user space only. It uses system calls to get some work done by kernel.

The stack memory will be part of process context area in memory. i.e user space.

Suppose your process is running, get the PID by ps -ax. say 1234 is your PID.

cat /proc/1234/maps will give you the mapping of that particular process.

In thats maps file, you can check the stack for stack mapping.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...