Skip to main content

Command Palette

Search for a command to run...

Process Management

Published
2 min read
Process Management
M

Hi, How are you !! Hope you doing good....

I got introduced to Cloud initially. As I went ahead learning what is cloud and how it works, then got to know a field which is DevOps that makes Cloud model more effective.

So, as I started working & got good experience on AWS. I have been learning the DevOps tool and technologies on how to use it with the Cloud, which will give me good understanding on how Cloud and DevOps go hand in hand to deploy my applications.

Last Blog Review

In the last blog we understood, what is meaning of Adding ip to an interface, how to do it. DHCP can add IP address to an interface and static assignment.

What happens when a process creation happens ?

When any program is executed a new process is created. Due to which a unique ID is assigned to it, which is known as PID. A PID value is always a positive number starting from 1. Now its depended on upon a system having init or systemd process, they always get the PID value 1 because this will be the first process in a system and it is the ancestor of all other processes.

The maximum value of PID is defined in the pid_max file, which should be available in the /proc/sys/kernel/ directory. By default, the pid_max file contains the value 32768 (max PID + 1), which means a maximum of 32767 processes can exist in a system simultaneously. We can change the value of the pid_max file depending upon needs.

Parent process -

A process which creates another process is called parent process

Child process -

The method of creating child process is called forking, which inherits the properties of its parent process

Understanding by example -

  1. Lets create a new process by creating a file “vim new.txt”

  2. As we run this cmd, a new process is created to read and edit the .txt file in vim editor

  3. So, as vim command is ran, the process will call the process will call the /usr/bin/vim to execute the task ahead of it

  4. In this ex. the vim command is called from bash, so bash becomes parent of process vim

Command to know PID and PARENT PID -

pidof -

To know the pid process of the vim command

pidof vim

1234

ps -

To know the parent pid

ps -o ppid= -p 1234

2345

Once a task is completed, a process gets terminated and PID is free to get assigned to a new process based on need.

Conclusion →

In this blog we understood, what is process management, parent process, forking, example of it and command for knowing the process id.

Image credit → https://share.google/images/wuoye6n8bYKvOpOkw

💡
That’s a wrap for today’s post! I hope this has given you some valuable insights. Be sure to explore more articles on our blog for further tips and advice. See you in the next post!

More from this blog

Mihir's Tech blog

69 posts