# Call stacks

호출 스택은 프로그램이 함수들을 호출할 때, 각 함수의 실행 상태를 순서대로 쌓는 메모리 공간입니다.

대부분의 현태 CPU 아키텍처에서 스택은 높은 주소에서 낮은 주소로 내려가기 때문에, 실제 함수의 호출 순서와 반대인 LIFO(Last in first out) 구조를 가집니다.

<figure><img src="/files/lnXHVFiG5pNctToWgCkF" alt=""><figcaption><p><a href="https://velog.io/@rany/Data-Structure-3.-%EC%8A%A4%ED%83%9D">https://velog.io/@rany/Data-Structure-3.-%EC%8A%A4%ED%83%9D</a></p></figcaption></figure>

&#x20;`func1 → func2 → func3` 와 같이 순서대로 실행되는 함수를 빌드하여 호출 스택을 확인하면 스택의 제일 높은 주소에 func3이 있는 것이 확인됩니다.

<figure><img src="/files/wGTN4ehK30TLwW7H9Z6L" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.pentestwiki.com/etc/system-internals/call-stacks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
