commit c553e487107edf14add19cdaf849c67ac1f69c4c
parent 21e69e06117e06546b09f3ed6032e3e5d18db5f4
Author: ling0x <ling0x@users.noreply.github.com>
Date: Mon, 15 Jun 2026 17:17:04 +0100
refactor: txt
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/memory_management/stack_in_memory.txt b/memory_management/stack_in_memory.txt
@@ -0,0 +1,7 @@
+The stack is located in the computer's main memory (RAM), not inside the CPU. However, the CPU plays a crucial and direct role in managing this memory region through specialized internal components.
+
+The Stack in Memory
+The stack is a designated segment of RAM used to manage short-lived data like function calls, local variables, and return addresses. Each active thread in a program is allocated its own dedicated stack space within the system's memory. While the computer structurally views this area the same as the rest of the RAM, it organizes and accesses the data in a strict Last-In-First-Out (LIFO) sequence.
+
+The CPU's Role
+While the actual data resides in RAM, the CPU tracks the stack using a dedicated internal register called the Stack Pointer (SP). This register continuously holds the exact memory address of the top of the stack, allowing the processor to efficiently locate the current frame of data. Additionally, CPUs feature built-in machine instructions—such as push, pop, call, and return—that allow them to quickly and automatically manipulate this specific region of memory.
+\ No newline at end of file