The stack segment holds the function call stack for each process, including local variables, return addresses, and function parameters. Each process requires an independent stack to ensure correct execution. The steps taken by kernel to ensure each process has its own independent stack are:-
The kernel allocates, a new stack for the child process and copies the contents of the parent's stack to the child's stack.
This ensures that both processes can continue execution independently without interfering with each other's stack data.