Process management in linux

mazenet_solution 8,823 views 18 slides May 25, 2016
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

overview of process,process handling, monitoring process using commands.


Slide Content

Process Management in L inux Manikandan.C 9677718889 Senior R edhat Trainer

!!!Process!!! what it is ?? A program is a series of instructions that tell the computer what to do . When we run a program, those instructions are copied into memory and space is allocated for variables and other stuff required to manage its execution. This running instance of a program is called a process and it's processes which we manage .

For Example

1 st -> As soon as we open a terminal a process name bash is started. . Rite ???? Tis systemd the parent process for all descendant process is responsible. 2 nd -> users are creating process by command to execute some program that is process . Who is that creating process ?? Systemd , most of the daemon process are created ,handled and controlled Users, all the commands in the foreground creates process

Description of process Like humans even process has the information like when it is created, address space of allocated memory, security properties including ownership credentials and privileges, one or more execution threads of program code, and the process state . NOTE: All processes are descendants of the first system process SYSTEMD.

Small briefing on -> fork, pthreads . FORK: Fork is nothing but an existing parent process duplicates its own address space and create a new child process structure. Pthreads :(POSIX THREADS) Parallel execution model which allows a program to control multiple different flows of work that overlap in time. Mainly for the multitasking purpose

Linux Process states RUNNING SLEEPING STOPPED ZOMBIE

Types of terminal Tty and pty : tty is called teletype where user interacts with the system. Pty is called as the psuedoterminal where the process uses as its terminal in the background. And many would have came across the pts terminal where pts is nothing but the slave part of pty terminal .

RUNNING When a command triggers a program, the process is automatically Name Flag Kernel-defined state and description Running R TASK_RUNNING - The process is either executing on a CPU or waiting to be executed.

Sleeping             Sleeping S TASK_INTERRUPTIBE : The process is waiting for some condition: a h/w request , system resource access or signal. When an event or signal satisfies the condition, the process returns to Running. D TASK_UNINTERRUPTIBLE - Like TASK_INTERRUPTIBLE, except that delivering a signal to the sleeping process leaves its state unchanged. K TASK_KILLABLE : identical to D state, but modifies to allow the waiting task to respond to a signal to be killed .

STOPPED Name Flag Description Stopped T TASK_STOPPED: The process has been stopped, usually by being signaled by a user or another process . The process can be continued (resumed) by another signal to return to Running. T TASK_TRACED: A process that is being debugged is also temporarily Stopped and shares the same T flag.

ZOMBIE Name Flag Description Zombie Z EXIT_ZOMBIE - Process execution is terminated, but the parent process has not yet issued a wait4( ) or waitpid ( ) system call. The OS will not clear zombie processes until the parent issues a wait()-like call   X EXIT_DEAD: when the parent cleans up (reaps) the remaining child process structure, the process is now released completely. This state will never be observed in process-listing utilities.

Process

Process commands usage

Examples > To display all the process: # ps – ef # ps ax > To display process by user: # ps –f -u apache,postfix # ps –f -u linuxguy

> To show process by name or process Id: #Ps -C apache2 # ps -f -p 2764 > To get the information on particular process: # ps – ef | grep postfix

> To display threads of process: # ps -p 2764 –L > To know the parent id of the process: # ps – ppid 2543 > To customize the view of process display: Ps – eo pid,uname,pcpu,pmem,comm > To list process in hierarchy : # ps – ef - - forest

Thanks for watching