DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Know Your Linux 04: Processes
Bassem IbrahimπŸ‘¨β€πŸ’»πŸ‡ͺπŸ‡¬
Bassem IbrahimπŸ‘¨β€πŸ’»πŸ‡ͺπŸ‡¬

Posted on • Updated on • Originally published at bassemmohamed.me

Know Your Linux 04: Processes

Hello and welcome to the fourth entry in β€œKnow Your Linux” series, This time let’s talk about Linux’s processes.

Before diving right in πŸ„β€β™‚οΈ, Make sure to check out the previous entry in the series.

Now let’s get down to business, First off. WTF is a process?

Linux’s Processes

A process is a running instance of a lunched executable program. That program could be a graphical application that the user is interacting with πŸ’» or a service that is running the background πŸƒβ€β™‚οΈ. Every process must have :

  • Pid. You guessed itπŸŽ‰ Process id.
  • PPid. What nowπŸ€” Parent process id.
  • The process state.
  • Address space of allocated memory
  • Allocated system resources
  • Security properties like ownership and privileges.

Every process is created by its parent process and inherits its properties from the parent. Also, Any process has the ability to create child processes through a method called fork. Hmmm now, what about the first process? Good question πŸ‘ All processes are descendants of systemd which is the first system process and has a Pid of 1.

Process’s states

Every process must have some kind of state. That changes according to circumstances.

State Code State State description
R Running πŸƒβ€β™‚οΈ The process is either running in the CPU right now or waiting in the queue to run.
S Sleeping (I) 😴 The process is interruptible, which means it is waiting until a certain event (signal). Once it is satisfied it will return to running.
D Sleeping 😴 The process is uninterruptible, which means it will not respond to signals. Used only under certain conditions.
K Sleeping 😴 The process is killable. Same as D, but it only responds to the kill signal. You know, Just in case 🀯.
T Stopped 🀚 The process has been stopped usually by a user or another process. Could be resumed by another signal. No worries.
Z Zombie 🧟 The process is exiting. It released all its resources except the Pid. Just waiting to be terminated by the parent process.
X Dead The process is dead. It exited successfully. horraaaay πŸŽ‰!

A short post for a change, That’s all from my side. βœ‹
If you enjoyed the post, please let me know and check out the next entry. πŸ™„

As always,
Happy coding πŸ”₯πŸ”₯
β€œΩƒΩˆΨ― بسعادة”

Top comments (1)

Collapse
maxdevjs profile image
maxdevjs

lAunched?

🌚 Life is too short to browse without dark mode