Перейти к содержанию

Processes


Number of running processes in system is limited. For x32 ~ 32k, x64 ~ 4kk.

Below describes 2 most popular utilities for working with processes in Linux - ps and top.

ps

ps - display running processes. ps itself always be in this list of processes, cause ps do screenshot of ddr and show it result.

  • ps -e - show all processes from all users

  • ps -f - verbose information about process (add PPID, C, STIME, TTY columns)

  • ps #### - process PID - show information about certain process with this PID

Columns which ps displayed:

  • UID - userid - user which ran the proccess

  • PID - process id - uniq number of the each process. After procces will be end, this number will be free and can be assigned to another proccess.

  • PPID - parent id - number of the parrent process which "borned" current proccess

  • C - process priority

  • STIME - startup time of process

  • TTY - the terminal that the process associated with.

  • ? - usually process started by system and not use GUI

  • tty1/tty2 - processes with GUI

  • pts/0, pts/1 - processes running in emulator of the terminal

  • TIME - CPU time

  • CMD - command whitch ran the process


top

top - interactive display linux processes.

Description of the rows and columns which it displayed:

FIRST ROW:

  1. Current time
  2. Uptime
  3. Number of active sessions
  4. System load average from 1, 5 and 15 minutes

SECOND ROW:

  1. Number of all runing processes
  2. Number of active processes
  3. Number of sleeping processes
  4. Number of stopped processes
  5. Number of zombie processes

THIRD ROW:

info about CPU utilization:

us - user CPU time - percent of time spent for user space. User space - all programs except the kernel

sy - percent of time spent to kernel space

ni - percent of time spent to processes with low priority (set up with nice utility)

id - idle time

wa - input output wait

hi -hardware interrupts

si - software interrupts

st - steal time. Show how long real CPU has been unavailable for virtual machine

FOURTH ROW

info about DDR (all values with Mebi- prefix).

Note

In Linux, free DDR space OS use for disk cache.

total - total DDR

free - free DDR

used - used DDR

buff/cache - DDR used for cache

swap - value of disk swap

MAIN TABLE

PID - process PID

USER - process owner

PR - current priority (rt is real time)

NI - niceness of the proccess

VIRT - total amount of memory using of process (iclude all memory program code, shared libraries, memory pages unloaded to the disk. In most cases - this indicator useless)

RES - resident set size memory - it's area which not unloaded to disk and located in DDR

SHR - memory which can be shared with another processes

S - status of the process (S - sleep, R - running, I - idle core thread, Z - zombie)

%CPU - CPU utilization in percent. By default shows by the core, not for all CPU

%MEM - DDR utilization in percent: RES/total

TIME+ - how long CPU works with the process


nice

nice run a program with modified sheduling priority.

niceness values range from -20 (most favorable to the process) to 19 (leas favorable to the process)

nice -n 5 firefox - run firefox with desired priority equal 5

renice - change niceness for running programm