Call Stack
Discover how the call stack manages active function calls and local states in D programming. Learn how fibers allow multiple call stacks within a single thread to improve efficiency in concurrent execution and understand the role of recursion in call stack operations.
We'll cover the following...
A fiber is a thread of execution that enables a single thread to achieve multiple tasks. Compared to regular threads that are commonly used in parallelism and concurrency, it is more efficient to switch between fibers. Fibers are similar to coroutines and green threads.
Fibers enable multiple call stacks per thread. Therefore, to fully understand and appreciate fibers, one must first understand the call stack of a thread.
Call stack
The parameters, non-static local variables, return values, and temporary expressions of a function, as well as any additional information that may be needed during its execution, comprise the local state of that function. The local state of a function is allocated and initialized automatically at run time every time that function is called. ...