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

linux, operating-system, unix

Solution

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.

Problem

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?

Original source

Related problems