Navrangpura, Ahmedabad, Gujarat
Follow us :

What is the Process of Management

A process is an action that takes place when a program is run. Any procedure needs computer resources to be performed.

The operating system must effectively manage all of these processes and resources since the computer system can run multiple processes at once, each of which uses the same resource.

In order to preserve consistency in the system, some resources must be used by a process all at once. If this does not occur, the system may experience deadlock and inconsistent behavior

Through actions like resource allocation and process scheduling, the operating system is able to carry out these processes. The CPU (Central Processing Unit) is utilized by a process when it runs on a computer device’s memory. The operating system is responsible for coordinating the computer’s many processes…

A process has a collection of executable instructions that we refer to as process code. The resources needed for the execution of this data are referred to as Process Components since certain data is also related to the process that is being used.

Process management execution

In process management, the following duties are carried out:-

( 1 ) Scheduling CPU threads and processes.:-
( 2 ) It functions to add and remove user- and system-level processes.
( 3 ) The system’s running processes are paused and then resumed.
( 4 ) It offers a system for synchronizing processes.
( 5 ) Additionally, this method offers a communication mechanism.

When a program is loaded into memory, it becomes a process and may be broken down into the following four components:-

Process:- A process is a running instance of a launched, executable program.
A process consists of:-
➢ An address space of allocated memory.
➢ Security properties including ownership credentials and privileges.
➢ One or more execution threads of program code.
➢ Process state

The environment process includes:-

➢ Local and Global variables.
➢ A current scheduling context.
➢ Allocated system resources, such as file descriptors and network ports.

How to Find the Process State

Using the top command is the simplest technique to determine the condition of the process. This command displays the top processes that are currently active along with a few columns by default. In the “S” column, the state is typically represented by one character. Additionally, the ps command is available. Based on the criteria you pass it using flags, this will show processes. Depending on the data you wish to view, it accepts a few different flags. “ps aux” is the typical one.
Although you should always consult the man pages for your distribution and specific commands, the following are the most typical mappings of character to state.

Linux process States:-

( 1 ) R (running):- TASK_RUNNING
( 2 ) S (sleeping):- TASK_INTERRUPTIBLE
( 3 ) D (sleeping):- TASK_UNINTERRUPTIBLE
( 4 ) K (sleeping):- TASK_KILLABLE
( 5 ) I (sleeping):- TASK_REPORT_IDLE
( 6 ) T (stopped):- TASK_STOPPED
( 7 ) T (stopped):- TASK_TRACED
( 8 ) Z (zombie):- EXIT_ZOMBIE
( 9 ) X (zombie):- EXIT_DEAD

( 1 ) R (running):- TASK_RUNNING
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state

( 2 ) S (sleeping):- TASK_INTERRUPTIBLE
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state

A well-coded program enters the INTERRUPTABLE_SLEEP state as it waits for this. A process can be quickly and trouble-free terminated in this state. When a process enters this state while awaiting input, it might step aside and allow other processes to receive CPU time. Circulating through CPU time would be a waste of resources.

( 3 ) D (sleeping):- TASK_UNINTERRUPTIBLE
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state.

( 4 ) K (sleeping):- TASK_KILLABLE
TASK_RUNNING: The process is either executing on a CPU or waiting to run.
The process can be executing user routines or kernel routines (system calls), or
be queued and ready when in the Running (or Runnable) state

( 5 ) I (sleeping):- TASK_REPORT_IDLE
TASK_REPORT_IDLE: A subset of state D. The kernel does not count
these processes when calculating load average. Used for kernel threads.
Flags TASK_UNINTERRUPTABLE and TASK_NOLOAD are set. Similar to
TASK_KILLABLE, also a subset of state D. It accepts fatal signals.

( 6 ) T (stopped):TASK_STOPPED
TASK_REPORT_IDLE: A subset of state D. The kernel does not count
these processes when calculating load average. Used for kernel threads.
Flags TASK_UNINTERRUPTABLE and TASK_NOLOAD are set. Similar to
TASK_KILLABLE, also a subset of state D. It accepts fatal signals.

( 7 ) T (stopped):- TASK_TRACED
ASK_TRACED: A process that is being debugged is also temporarily
Stopped and shares the same T-state flag.

( 8 ) Z (zombie):- EXIT_ZOMBIE
EXIT_ZOMBIE: A child’s process signals to its parent as it exits. All resources
except for the process identity (PID) released.

( 9 ) X (zombie):- EXIT_DEAD
EXIT_DEAD: When the parent cleans up (reaps) the remaining child process
structure, the process is now released completely. This state will never be
observed in process-listing utilities.

Basic Command

1. /proc/cpuinfo:-  This file basically serves as a repository for the machine’s current resources.

[root@server ~]# vim /proc/cpuinfo

2. ps:- Typically, the ps command is used to display the OS on the machine’s active processes.

[root@server ~]# ps

3. ps aux:- Different display formats are used for processes

[root@server ~]# ps aux

4. ps lax:- Processes are displayed in different formats.

[root@server ~]# ps lax

5. ps -ef:- Processes are displayed in different formats.

[root@server ~]# ps ef

6. pstree:- Is employed to present a process as a tree.

[root@server ~]# pstree

7. pstree -p | grep firefox:- To find the Firefox processes in the process tree structure

[root@server ~]# pstree -p | grep firefox

Running Firefox 

8. Sleep:- In order to establish a fake job, use the sleep command. The execution can be delayed by using a dummy task. By default, it measures time in seconds, but you can change the format by including a tiny suffix (s, m, h, or d) at the end. This command pauses the process for the duration specified by NUMBER.

sleep NUMBER[SUFFIX]...

Note: The sleep command will delay the sum of the values if you declare more than one NUMBER with it.
the options offered by the sleep command

➢  Sleep –help:- It provides assistance information.

[root@server ~]# sleep --help
Usage: sleep NUMBER[SUFFIX]...
or: sleep OPTION
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days. NUMBER need not be an
integer. Given two or more arguments, pause for the amount of time
specified by the sum of their values.

--help display this help and exit
--version output version information and exit

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/sleep>
or available locally via: info '(coreutils) sleep invocation

➢ -version:– Version information is shown.

[root@server ~]# sleep --version

9.top:- In Linux operating systems, the top command is a frequently used tool that offers real-time resource monitoring. It presents a live, interactive view of system processes and how much resource each one is using. The top is frequently used to examine system performance, spot resource-hungry programs, and keep tabs on a Linux system’s general health.
The top command in a terminal displays a table-like interface with numerous columns that include data on various system components when you run it. You might see a few of the important columns, such as:

( 1 ) PID (Process ID): A special identification number is given to each active process.
( 2 ) USER: The user account that the process is currently operating as.
( 3 ) PR (Priority): The process’s priority.
( 4 ) The “niceness” of the process, which affects its priority, is referred to as NI (Nice value).
( 5 ) Virt (Virtual Memory): The total amount of virtual memory a process is using.
( 6 ) The process’s non-swapped physical memory is known as RES (Resident Memory).
( 7 ) SHR (Shared Memory): The process’s shared memory.
( 8 ) CPU%: The process’s share of total CPU utilization.
( 9 ) MEM%: The process’s percentage of memory (RAM) consumption.
( 10 ) TIME+: The total amount of CPU time that the process has used.

In addition to these columns, the top of the display includes data on system-wide CPU consumption, memory usage, uptime, and other pertinent metrics.
By pressing different keys, you can interact with the top in real time and do numerous tasks. For instance, hitting ‘k’ will allow you to signal processes, ‘f’ will let you select which columns to display, and ‘q’ will stop the top command.
Remember that the top needs root or superuser access to display details about all running processes.

Press->h (Help):- Pressing the h key displays all top command-related choices

Renice the processes:- Using the top command

10. kill:- When a process is running on the system, the “kill” command in Linux can be used to signal its termination or take other actions. Although its main usage is to terminate processes, it can also be used to deliver additional signals to processes for a variety of purposes.
The “kill” command’s basic syntax is as follows:

kill [options] <PID>

The process ID of the process you want to target is shown below as PID>. The “ps” command or other process monitoring tools can be used to locate the process ID.
By default, the termination signal (SIGTERM) is sent to the specified process when you execute the “kill” command without providing a signal. This enables the process to carry out any necessary cleanup procedures prior to ceasing.
With the “-” option, you can, however, optionally specify different signals. For instance, the “-9” option is frequently used to SIGKILL (forcefully terminate) a process. The SIGKILL signal kills the process immediately and cannot be caught or disregarded by the process.

[root@server ~]# top

An illustration of how to end a process with process ID 909 is as follows:

[root@server ~]# kill 909

Renice the processes:- Using the top command

Set signal on processes:- Using the top command

Author

by admin

bg

Subscribe to our Newslatter

Sign Up to Our Newsletter to Get Latest Updates & Services

mail box
logo-footer
HighSky IT Solutions Pvt. Ltd. is a leading IT training and certification programs in Red hat, RSCSA Cloud, Open-source, AWS, Devops and various domains.
Contact Info

2nd floor, Rohera Arcade, opp SOTC office, Near Navrangpura police station, Navrangpura, Ahmedabad -380009 Gujarat

Copyright ©2024 Design & Developed by HighSky IT