Linux terminologies: Process, PID and TID

Linux terminologies: Process, PID and TID

A short informative guide about Processes in Linux🐧 and how to kill them

Process of a butterfly

Process...What is that?πŸ€”

  • A process is an instance of one or more related tasks (threads) executing on your computer. πŸ”
  • Not the same as a program or a command. ❌
  • A single command may start several processes simultaneously.
  • Some processes are independent of each other while others are related. πŸ‘‰πŸ½πŸ§πŸ‘ˆπŸ½
  • A failure of one process may or may not affect the others running on the system.

Process ID Star Wars Single Stormtrooper

Process Id(PID) 웃:

  • There are always multiple processes being executed in the background.
  • The operating system keeps track of them by assigning each a unique process ID (PID) number, used to track process state, CPU usage, memory usage, etc.

Star Wars different than Stormtroopers

Thread ID(TID) 웃웃웃웃웃웃:

  • For a multi-threaded process, each thread shares the same PID but has a unique TID.

  • To get a task-manager-ish view of running processesπŸ§‘πŸ½β€πŸ’Ό: top

  • To kill a process (you can only kill your processes; those belonging to another user are off-limits unless you are root): kill -SIGKILL <pid>or kill -9 <pid>

Kill Stormtrooper

To kill an app running in backgroundπŸ’»:

  • First, we need a PID of that app(grep works as a filter)πŸ”Ž: top | grep <appName>
  • Now that we have a PID, we can kill that app/process βœ–β€Ώβœ–:
    kill -9 <pid of that app>
Β