O'Reilly logo

Hands-On System Programming with Linux by Kaiwan N Billimoria

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Why a process stack?

We're taught to write nice modular code: divide your work into subroutines, and implement them as small, easily readable, and maintainable C functions. That's great.

The CPU, though, does not really understand how to invoke a C function, how to pass parameters, store local variables, and return a result to the calling function. Our savior, the compiler, takes over, converting C code into an assembly language that is capable of making this whole function thing work.

The compiler generates assembly code to invoke a function, passes along parameters, allocates space for local variables, and finally, emits a return result back to the caller. To do this, it uses the stack! So, similar to the heap, the stack is also a dynamic ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required