exit()=> A process can request the kernel to terminate by calling
execve()syscall to load and execute an entirely new program. An
execve()call destroys the existing text, data, stack, and heap segments, replacing them with new segments based on the code of the new program.
_exit()system call (or the related exit() library function)
wait()system call. In the case of a call to
_exit(), the process explicitly specifies its own termination status. If a process is killed by a signal, the termination status is set according to the type of signal that caused the death of the process.
/sbin/init. All processes on the system are created (using
fork()) either by init or by one of its descendants. The init process always has the process ID 1 and runs with superuser privileges. The init process can't be killed (not even by the superuser), and it terminates only when the system is shut down. The main task of init is to create and monitor a range of processes required by a running system.
fork()inherits a mapping from its parent.
|operator) and FIFOs, which can be used to transfer data between processes;
ctrl+c) on the keyboard
killcommand can be used to send a signal to a process. The
kill()system call provides the same facility within programs.
int 0x80), which causes the processor to switch from user mode to kernel mode and execute code pointed to by location
0x80(128 decimal) of the system’s trap vector.
0x80, the kernel invokes its
system_call()routine to handle the trap. This handler:
sys_call_table). If the syscall service routine has any arguments, it first checks their validity; for example, it checks that addresses point to valid locations in user memory. Then the service routine performs the required task, which may involve modifying values at addresses specified in the given arguments and transferring data between user memory and kernel memory (e.g., in I/O operations). Finally, the service routine returns a result status to the
errnousing this value. The wrapper function then returns to the caller, providing an integer return value indicating the success or failure of the syscall.