Different Types Of Processes In Linux Or Unix?
 

Different Types Of Processes In Linux Or Unix?

 

This post was last updated on August 1st, 2020 at 12:09 pm

In a Unix-like operating system, a process is a program in execution. Kernel identifies a process with a unique id called process id or PID. Whenever a command is issued a new process starts.

In this article, we will discuss different types of processes in Linux or Unix.

Parent and child process

A child process is a process that is created by another process(parent process), a child process is also known as the subprocess. There are two major ways of creating a child process: fork system call which is preferred in Unix like operating systems, the spawn is the preferred way in modern NT kernel of Microsoft Windows.

A process becomes the parent process when it creates one or more subprocess processes.

The init process

The init process is the very first process that gets created when a Linux or Unix machine starts. Every process in Linux has a parent process. So every other process of a system is the children of the init process. It has some special privileges so it cannot be killed it only terminates when the system gets shutdown. It has the process id of 1 which never changes.

Zombie and orphan process

Suppose there are two processes one is the child and the other is the parent process. Two possible scenarios are –

  • If the parent process terminated or gets killed before the child process. The child process becomes an orphan process now this will be rescued and adopted by the init process. And the init process becomes the parent process.
  • If the child process terminated or gets killed and the parent does not get or able to fetch the termination status. The terminated child process will become a zombie process.

Daemon process

Daemon processes are system-related background processes that often run with the permissions of root and services requests from other processes. Most of the time these processes run in the background and wait for processes. A Daemon process does not require a controlling terminal.

The name of a daemon process normally ends with the letter d. Some of the examples of daemon processes in Unix are −

  • crond –This is a job scheduler that runs jobs in the background.
  • syslogd – It is the system logger that implements the system logging facility and collects system messages.
  • httpd –This is the webserver daemon process.

The processes can also be categorized on the basis of how they are running in a system. Whenever a command executes, it starts a new process. A process can start in two ways –

Foreground process

By default, a process started by a user runs in the foreground. It takes input from the command prompt and displays output to the computer screen. If a foreground process is running, the terminal prevents initiating a new process until the existing one does not get finished.

Background process

These are the processes that do not require keyboard input. Another process can be started from the terminal while the previous one is running in the background. To start a background process you should add an ampersand(&) at the end of a command. From a terminal, you can switch between foreground and background processes using fg and bg commands.

Previous [ubuntu] Adding mirror to Ubuntu 20.04 ZFS install
Next Leksmaker
 

About author

You might also like

How To 0 Comments

How To Create RAR Archive In Linux?

This post was last updated on August 1st, 2020 at 12:59 pmLike other archives, a RAR file is a data container that stores one or several files in compressed form.

Linux Topics 0 Comments

How To Setup GNOME GUI On CentOS 8?

GNOME is a free and opensource desktop environment for Unix-like operating systems. It is a user-friendly desktop environment and comes default in various distributions such as Ubuntu, Debian, Fedora, etc.

Linux Topics 3 Comments

How to Create a USB Bootable Ubuntu Live Disk

This post was last updated on November 3rd, 2020 at 05:35 pmLooking to make a Live Ubuntu USB disk? then you have arrived at the right place. Here I will

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply