Professor said that modern processor needs runtime stack.
But he didn't explain the reason.
Why is the runtime stack required in the modern processors?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
I would say that "required" is a bit of strong word. Processors provide hardware support for stacks to help implement the call stack abstraction. Having special instructions to do so can improve performance. Note however that some processors like ARM (except in Thumb mode) do not really have special instruction to do so, the ldm/stm instructions with pre/post inc/dec are flexible enough to do so.
Stacks are quite useful for running software. There is no reason why stacks would need to be part of processor. For example, the POWER architecture does not have a call stack as part of the processor. All it has is an architecture that jumps to one address while storing the address following the branch instruction in a special purpose register. ONE special purpose register. No stack.
There are several aspects.
Processors meant to execute most common languages (such as C) need to implement efficiently stacks for parameters passing and call/return addresses. Some of that stack is usually replaced by registers, for efficiency (using registers for passing parameters to subroutines, link register ...), but when registers are not sufficient, processors typically feature instructions for pushing and popping parameters from the stack (x86 PUSH/POP, auto increment/decrement memory access instructions, ...)
From a software point of view, the stack is a place in memory. Accessing memory (typically in cache) for all these data transfers can induce latency and power draw. Some advanced CPUs have special memories and bypassing to avoid cache accesses for parameters and return addresses.