Red Hat Linux Reference Guide

Linux Introduction

VI-EDITOR

Process Management

Linux Installation

Disk Partitions & File System Management

Logical Volume Management - LVM

User & Group Administration

Package Management

Network File System - NFS

Domain Naming System - DNS

Apache HTTP Web Server

KickStart Installations

FTP server

BOOT PROCESS

Dynamic Host Configuration Protocol - DHCP

Job Scheduling

File Links

Swap Management

Log Management

Performance Management

Linux Troubleshooting

Linux Summary

Start Preparation Smartly

We have the collection to start prepartion smartly.

Start Assessment

Red Hat Linux Reference Guide

  DevOps Tech Hub

116 Followers

What is Linux Process?


In Linux, When user execute a command on the Shell the command related instance will be  created in the real memory to process the command for execution. Instance created for the command is called as Process. 

In Linux, Every instruction or  task is carried out as process. Processes will be created and schedule for CPU  turn for execution. Once the process is executed and the output is  generated then that process will be  exits or terminated. 

A Process may have different states from the time it is  created and then terminates due to various conditions and behavior  of the execution life cycle.

Process States:

Every process will go through the life cycle as described below, Process state determines what is the status of the process initiated by the user. Once the process is  completed  its execution it will be terminated and remove from the process table. 

Process States

  • Running – here it’s either running (it is the current process in the system) or it’s ready to run (it’s waiting to be assigned to one of the CPUs).
  • Waiting – in this state, a process is waiting for an event to occur or for a system resource. Additionally, the kernel also differentiates between two types of waiting processes; interruptible waiting processes – can be interrupted by signals and uninterruptible waiting processes – are waiting directly on hardware conditions and cannot be interrupted by any event/signal.
  • Stopped – in this state, a process has been stopped, usually by receiving a signal. For instance, a process that is being debugged.
  • Zombie – here, a process is dead, it has been halted but it’s still has an entry in the process table.

Process Types:

There are fundamentally two types of processes in Linux:

  • Foreground processes (also referred to as interactive processes) – these are initialized and controlled through a terminal session. In other words, there has to be a user connected to the system to start such processes; they haven’t started automatically as part of the system functions/services.
  • Background processes (also referred to as non-interactive/automatic processes) – are processes not connected to a terminal; they don’t expect any user input.

How to run Process in Foreground

[kloudways@ ~]$./script    # Running script in Foreground
[kloudway@ ~]$ls -l       # Running command in Foreground
total 4
drwxr-xr-x 2 root root  6 Jun 26 14:59 dir1
-rwxr-xr-x 1 root root 11 Jun 26 14:59 script
[kloudway@ ~]$

How to run Process in Background

[kloudway@ ~]$./script &   #Running script in Background
[1] 32722               #Shows Process ID
[kloudway@ ~]$ls -l &      #Running command in Background
[2] 32737
[1]   Done                    ./script  #Process Completed
[kloudway@ ~]$total 4
drwxr-xr-x 2 root root  6 Jun 26 15:00 dir1
-rwxr-xr-x 1 root root 11 Jun 26 14:59 script

[2]+  Done                    ls --color=auto -l
[kloudway@ ~]$



Previous Next