processes daemon jobs systemctl ctrl+z ctrl+c bg fg kill 9/15 top | ulimit

Every process has a unique identifier called a Process Identifier (PID). Also, every process
has a Parent Process Identifier (PPID). There is an exception, init (or systemd). The init
process starts all other processes and has a PID of 1. This process is special because it

cannot be killed

Are there limits on the resources? Yes. The ulimit command is used to view and set the hard
and soft limits on a process. It is not normally needed by the user; however, if you’re curious,

run ulimit -a on your system.

--------------
daemon - service that is started autoatically when computer is booted
systemctl command is used to manage daemons
jobs - interactive processes, started from the shell

ctrl+z - stops job temp

ctrl+c - kills process
command & - moves to background


[root@192 ~]# dd if=/dev/zero of=/dev/null

^Z
[1]+  Stopped                 dd if=/dev/zero of=/dev/null
[root@192 ~]# jobs
[1]+  Stopped                 dd if=/dev/zero of=/dev/null
[root@192 ~]# bg
[1]+ dd if=/dev/zero of=/dev/null &
[root@192 ~]# jobs
[1]+  Running                 dd if=/dev/zero of=/dev/null &
[root@192 ~]# fg
dd if=/dev/zero of=/dev/null
^Z
[1]+  Stopped                 dd if=/dev/zero of=/dev/null
[root@192 ~]# 

root@192 ~]# ps -HFaf
UID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
root     16461 29106  0 48076  2684   0 12:50 pts/1    00:00:00 su
root     16909 16461  0 29109  3224   0 12:50 pts/1    00:00:08   bash
root       420 16909  0 37763  1724   0 13:32 pts/1    00:00:00     ps -HFaf
[root@192 ~]# 


[root@192 ~]# pstree | more
systemd-+-ModemManager---2*[{ModemManager}]
        |-NetworkManager-+-dhclient
        |                `-2*[{NetworkManager}]
        |-2*[abrt-watch-log]
        |-abrtd
        |-accounts-daemon---2*[{accounts-daemon}]
        |-akonadi_control-+-4*[akonadi_agent_l---{akonadi_agent_l}]
        |                 |-akonadi_maildis
        |                 |-akonadi_nepomuk
        |                 |-akonadiserver-+-mysqld---30*[{mysqld}]
        |                 |               `-13*[{akonadiserver}]
        |                 `-{akonadi_control}

top
[root@192 ~]# top
top - 15:31:57 up  3:01,  3 users,  load average: 0.31, 0.11, 0.07
Tasks: 160 total,   1 running, 159 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.4 us,  0.4 sy,  0.0 ni, 98.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1008392 total,   363500 free,   441576 used,   203316 buff/cache
KiB Swap:  2097148 total,  2096576 free,      572 used.   376288 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                       
 2358 root      20   0  218788  34876  13408 S  1.7  3.5   0:05.44 Xorg                          
  654 root      20   0  302884   6468   4640 S  1.3  0.6   1:59.60 vmtoolsd                      
29081 centos    20   0  584544  28540  19228 S  1.3  2.8   0:15.70 konsole                       
  511 root      20   0       0      0      0 S  0.3  0.0   0:07.98 kworker/0:1                   
  948 root      20   0  178688   4320   3472 S  0.3  0.4   0:21.35 vmtoolsd                      
  966 root      20   0  157708   2268   1564 R  0.3  0.2   0:00.03 top                           
 3014 centos    20   0  431672  19784  15820 S  0.3  2.0   0:15.92 vmtoolsd                      
    1 root      20   0  125332   3900   2416 S  0.0  0.4   0:01.00 systemd                       
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd                      
    3 root      20   0       0      0      0 S  0.0  0.0   0:02.75 ksoftirqd/0                   
    6 root      20   0       0      0      0 S  0.0  0.0   0:00.15 kworker/u128:0                
    7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0       

rt - real time process, started by kernel
us - user
wa - I/O waiting

k - kill process
r- renice process.

nice from -20 to +19

-20 - process is very aggressive

only root can decrease priority

if you are a normal user, you can only decrease process priority
only root can increase priority

kill or top+k
signal 15 - nice way to terminate process. Leaves system in nice state
signal 9 - risk damaging open files




Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all