Stack frames of Linux processes and functions in processes

Source: Internet
Author: User

Stack frames of Linux processes and functions in processes

It mainly understands the differences and connections between the stack frames of Linux processes and the stack frames of functions.

It depicts the structure of a Linux Process. The stack to be followed in this article is shown in the process memory area where the stack is at the bottom of 0xc0000000.
The actual size allocated for each process in Linux is not discussed in detail.
The overall perception of the stack of Linux processes is so much, that is
1) The stack bottom is at 0xc0000000 (the stack bottom pointer is not required, and the function stack frame requires the stack bottom pointer)
2) stack growth direction and address decrease direction
3) stack top pointer esp
4) unknown size (not the focus of this article)
5) What is the content stored in it?


Another concept is the stack frame concept of the function mentioned above and its relationship with the Linux Process stack.
The function stack frame is in the stack structure in the process, allocated address space, and actual memory.
The overall understanding of function stack frames is as follows:
1) ebp is the stack bottom of the function stack frame.
2) esp is the top of the stack
3) The stack frames of all functions of a process are established when this function is called. After the caller is returned, the stack frames of the function to be called no longer exist.
4) The establishment and disappearance of stack frames of all functions is a dynamic process that changes with the execution of processes.


In the stack provided by the process, the functions in the process should solve the relationship between the caller and the called.
1) How do I access the called user from the caller?
2) how to return the caller from the called user?
3) How does the caller control the called user (passing the called function parameters )?
4) How is the value of the called reflected (Transfer of return values )?
And so on

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.