OpenSource For You

Death of a process

-

It’s nature’s rule that no one can live forever. So, unfortunat­ely, processes also have to die. A process dies by itself by calling exit() system call. This is how it selfdestru­cts. Processes can also die from a received signal or exception, which they cannot handle. Exit() then calls do_ exit(), which calls exit_mm(), exit_sem(), exit_files() and exit_ fs(), to release mm_struct, to de-queue processes waiting for the semaphore, to decrement count of usage of file descriptor­s and file system data, respective­ly. It also calls schedule() so that the next process can be scheduled.

With this, all resources are released except the kernel stack, task_struct and thread_info. That means the process is in the zombie state. Now it’s the responsibi­lity of the parent process to inform the kernel that its child is not required; then the kernel removes the process completely by calling release_task(), which again calls put_task_struct() to free the pages containing the process’ kernel stack and thread_info structure and deallocate the slab cache containing the task_struct.

 ??  ??

Newspapers in English

Newspapers from India