Process and Thread

Process To put it simply process is a program in an execution state, which has process id, process state, and priority. The process does not share the memory between each other and is unaware of the other process. States of the Process – Ready – Running – Waiting – Terminated – Suspended.

Thread Thread is the segment of the process which means a process can have multiple threads with shared memory access. A thread can execute any part of the process code, including parts currently being executed by another thread. States of the Thread – Running – Ready – Blocked.

Now we have some understanding of the Process and Thread. Let see the thread and process currently running in our system.

>>> top # show the process

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                           
 3213 sandeepk  20   0 3422616 389668 166132 S  15.5  4.8   3:35.47 firefox                                                                           
 4679 sandeepk  20   0 2931264 284812 144300 S  13.2  3.5   0:27.11 Web Content                                                                       
 1502 root      20   0  667788  87748  58564 S   7.3  1.1   0:37.59 Xorg                                                                       

Now let see the thread of the Process with PID: 3213

>>> ps -T -p 3213
  PID  SPID TTY          TIME CMD
 3213  3213 ?        00:01:45 firefox
 3213  3413 ?        00:00:17 IPC I/O Parent
 3213  3497 ?        00:00:01 Timer
 3213  3498 ?        00:00:00 Netlink Monitor
 3213  3499 ?        00:00:06 Socket Thread
 3213  3540 ?        00:00:00 Permission
 3213  3555 ?        00:00:00 gmain
 3213  3556 ?        00:00:00 gdbus
 3213  3560 ?        00:00:00 JS Watchdog
 3213  3561 ?        00:00:00 JS Helper
 3213  3562 ?        00:00:00 JS Helper
 3213  3563 ?        00:00:00 JS Helper
 3213  3564 ?        00:00:00 JS Helper
 3213  3609 ?        00:00:02 Cache2 I/O
 3213  3610 ?        00:00:00 Cookie
 3213  3640 ?        00:00:00 Worker Launcher
 3213  3678 ?        00:00:05 Softwar~cThread

So, that's all from my side about Thread and Process.

Cheers!

#100DaysToOffload