Process memory layout
Whenever you run an executable file, the operating system creates a new process. A process is a live and running program that is loaded into the memory and has a unique Process Identifier (PID). The operating system is the sole responsible entity for spawning and loading new processes.
A process remains running until it either exits normally, or the process is given a signal, such as SIGTERM
, SIGINT
, or SIGKILL
, which eventually makes it exit. The SIGTERM
and SIGINT
signals can be ignored, but SIGKILL
will kill the process immediately and forcefully.
Note:
The signals mentioned in the preceding section are explained as follows:
SIGTERM
: This is the termination signal. It allows the process to clean up.
SIGINT
: This is the interrupt signal usually sent to the foreground process by pressing Ctrl + C.
SIGKILL
: This is the kill signal and it closes the process forcefully without letting it clean up.
When creating a...