1 / 13

The kernel considers each program running on your system to be a process

Learn about different types of processes, process attributes, monitoring processes, and process management commands on Unix systems. Explore how to kill processes, signal processes, and manage process priorities with job control commands.

dyates
Download Presentation

The kernel considers each program running on your system to be a process

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. What is a process The kernel considers each program running on your system to be a process A process lives as it executes, with a lifetime that may be short or long A process is said to die when it terminates The kernel identifies each process by a number known as a process id, or pid

  2. Process type Process type init is the parent of all processes. Daemons are (server) processes that run continuously. init is a daemon. Batch processes are queued into a spooler area, where they wait to be executed on a FIFO basis. Interactive processes are initialized and controlled through a terminal session.

  3. Process Attributes PID or process ID, an integer. PPID or parent process ID, an integer. Nice number, the degree of friendliness of this process toward other processes (not to be confused with process priority, which is calculated based on this nice number and recent CPU usage of the process). TTY, the terminal to which the process is connected. RUID, or real user ID. The user issuing the command. EUID, or effective user ID. The one determining access permissions to system resources. RGID, or real group owner. The group of the user who started the process. EGID, or effective group owner. Different from RGID when SGID has been applied to a file

  4. Monitoring Processes top Display a dynamic real-time view of a running system. ps Report a snapshot of the current processes. pstree Display a tree of processes. time Run programs and summarize system resource usage.

  5. "ps" Syntax ps[options] ps This is the basic "ps" command, with no flags and no arguments. It will list basic information about your processes. ps -e This command lists every process that is currently running on the UNIX system. ps -ef This variation lists full information about every process that is currently running on the UNIX system. ps by itself (with no options) lists information about processes associated with your login shell (and only your login shell):

  6. Killing Processes A program can be killed by sending it a termination signal. kill Send a signal to a process. killall Kill processes by name. xkill Kill a client by its X resource. kill -15 is the default, and orders the process to terminate in an clean way. kill -9 sends a termination signal which can't be ignored.

  7. Signalling Processes A process can be sent a signal by the kernel or by another process Each signal is a very simple message: A small whole number With a mnemonic name names are all-capitals, like INT They are often written with SIG as part of the name: SIGINT Some signals are treated specially by the kernel; others have a conventional meaning There are about 30 signals available, not all of which are very useful

  8. [alaei@node59 ~]$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAX [alaei@node59 ~]$

  9. [alaei@node59 ~]$ ps PID TTY TIME CMD 15403 pts/4 00:00:00 bash 15421 pts/4 00:00:00 ps [alaei@node59 ~]$ kill 15403 [alaei@node59 ~]$ kill -9 15403

  10. Process Priority Process Priority Process priority is calculated from the nice number, and recent CPU usage of the process. nice Run a program with modified scheduling priority. renice Alter priority of running processes.

  11. Job control Commands Job control means switching between several jobs or processes. A foreground job occupies the terminal which initialized it. It can be put in the background, so that the terminal can accept new commands. command & Run command in the background. Ctrl + C Terminate a process running in the foreground. Ctrl + Z Suspend a process running in the foreground. bg Reactivate a suspended program in the background. fg Place a job in the foreground, and make it the current job. jobs Lists processes in the background. Each one has a number n and can be referred to by %n.

  12. Example Using the find example above, assume you first submitted the job in the foreground, but then realized how long it would take: $ find / -name linux >linux.list Step 1: You would first suspend the process (CTRL-Z): $ CTRL-Z Step 2: Next, use the bg command to send the suspended job to the background: $ bg [1] find / -name linux > linux.list&

  13. The at command The nohup command

More Related