System stack: Difference between revisions

Content added Content deleted
m (A little English)
m (I missed this other little bit)
Line 3: Line 3:
Most importantly, the system stack is used to store information about subroutine calls (where it gets the name "call stack"). The stack stores parameters for the function and a return address where the program should pick up when the function is finished. It also reserves a space for a return value to be popped by the system on return. The piece of stack used by a subprogram is called '''stack frame'''.
Most importantly, the system stack is used to store information about subroutine calls (where it gets the name "call stack"). The stack stores parameters for the function and a return address where the program should pick up when the function is finished. It also reserves a space for a return value to be popped by the system on return. The piece of stack used by a subprogram is called '''stack frame'''.


Because of its limited size, a stack may "overflow" if too many function calls are made without returning. This situation is dangerous because, if not handled properly (usually by the program stopping and freeing all of its memory), the stack could intersect and overwrite other memory from the program, other programs, or the [[operating system]]. In high-integrity systems one of strict design requirements is predictability of the stack size. Use of [[heap]] is usually prohibited, for the same reason.
Because of its limited size, a stack may "overflow" if too many function calls are made without returning. This situation is dangerous because, if not handled properly (usually by the program stopping and freeing all of its memory), the stack could intersect and overwrite other memory from the program, other programs, or the [[operating system]]. In high-integrity systems there are usually strict design requirements on the stack size. Use of [[heap]] is usually prohibited, for the same reason.


Often there exists more than one ''stack'':
Often there exists more than one ''stack'':