[Autogenerated] let's begin by quickly reviewing what the
stack is and while we do we need it.
So a stack is the fairly well known data structure built
with the last in first out concept.
The first item you push onto the stack is the last
one you pop out and vice versa.
And this is used to store return addresses and parameters
to functions when calling functions.
This of course depends somewhat on the calling convention.
We know that in X 64 coin convention, for example, the first four.
Indeed job pointer parameters are passed on or in
registers and any subsequent parameters,
if there are more than four, they will be passed on the stack.
The stack is also used to store local variables that are going
to be used by the function we're calling.
And this is sometimes referred to as a stock frame.
Stock frame is kind of the range of addresses that is used to store the
parameters and local variables and return address of a function.
So if you think about function, a calling function, B.
Calling function C.
You get multiple stack frames while the calls are in progress and then these
stock frames will be popped out when things start to return.
Now in user mode, user mode thread has two stacks.
One of them is in user space where of course the thread
can use to call functions in user mode,
but there's also one in kernel space for that same thread
will explain why that is in the next video,
in any case for kernel threads that run only in kernel mode.
They just have a single stack, which of course is in kernel space.