What is the role of stack in a microprocessor?

后端 未结 10 863
-上瘾入骨i
-上瘾入骨i 2020-12-10 08:34

What is the role of stack in a microprocessor?

10条回答
  •  眼角桃花
    2020-12-10 09:01

    A stack is an implementation of a LIFO (Last In - First Out) buffer. The FIFO (First In - First Out) is also known as a queue. But back to the LIFO.

    Stacks in the x86 architecture allow software designers to dispense with such strange stuff as return address registers and interrupt return address registers that are found in RISC processors. Everything can reside on the stack which means that there is a single standardized and unified method of handling calls/returns, parameters/local variables and interrupts/interrupt returns. The use of the method on separate stacks simplifies implementation of multi-threading.

    RISC, in contrast, uses a stack-like buffer though they keep significatnt parts of the related info elsewhere. RISC "stacks" may be faster (not sure) but they are definitely more difficult to understand than those of the x86.

提交回复
热议问题