1 / 15

Understanding and Managing Processes in a System

Learn about processes in a computer system, their life cycle, states, signals, and how to monitor and control them. Enhance your system administration skills.

cmatthew
Download Presentation

Understanding and Managing Processes in a System

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. Chapter 5 Controlling Processes Xiaoli Jiao 6/8/99

  2. What is a “Process”? --A program in execution --Only one process is actually executing at a time What Sys Administrator can do with processes? --Monitor the status of processes --Control CPU time a process can get --Send signals to a process --Suspend or halt process execution

  3. Address space segments of program code variables stack extra information Internal Data structures address space map current status execution priority signal mask owner Components of a process:

  4. What we are interested? • PID: Process Identification Number • PPID: Parent Process ID • UID & GID: Creator’s User ID and Group ID • EUID & EGID: “what resources can be accessed?” • Priority and Nice Value: “how much CPU time to receive?” • Control Terminal: the default linkages for standard I/O and error channels

  5. Life Cycle of A Process when system boots, kernel creates several processes autonomously New processes are created by other processes. (like new humans!) All processes except those kernel creates are descendants of init, which always has PID 1.

  6. Life Cycle of A Process-- Contd. • An existing process clones itself using system call forkto create a new process. • The new process use execsystem calls to begin execution of a new program. • When a process completes, it calls a routine named _exit to notify the kernel that it is ready to die. (--Zombie)

  7. Process StatesState MeaningRunnable The process can be executedSleeping Waiting for some resourcesSwapped Not in memoryZombie Trying to dieStopped Suspended(not allowed to execute)

  8. Signals • Unix defines a set of signals for software and hardware conditions that may arise during the normal execution of a process. • A process can specify an action for a signal, either: • catching the signal with a handler • or taking the default action • Each signal has a default action that may be any one of • ignoring the signal • terminating the process(& generate a core dump) • stopping the process • Signals KILL and STOP can not be caught, ignored or blocked

  9. Kill: Send Signals • Syntax : Kill[-signal]pid • Kill -l displays the available kill signals umbc9[1]% kill -lHUPINT QUIT ILL TRAP ABRT EMT FPE KILL(9) BUS SEGV SYS PIPE ALRM TERM(15) USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ • Kill pid defaults to sending TERM(15) • Kill-9pid last resort -- “Nuke” without mercy

  10. Priority and “nice value”Process with highest “internal priority” gets to run first • “Nice Value” -- how the process should be treated in relationship to other processes contending CPU BSD: -19 ~ +19 ATT: 0 ~ 39 Lower value => Higher priority • nice to set “nice value” at the process creation • renice is used to change the value during process execution

  11. Monitor Processes • ps--Processes Status ( “snapshot”) • ps -aux(ATT) • ps -ef (BSD) • top - display information about the top cpu processes A dynamically updated “big picture”

  12. actaeon.cs.umbc.edu[112] ps -aux |grep Jun |moreUSER PID %CPU%MEM SZ RSS TT S START TIME COMMANDroot 1260 0.0 0.3 1560 1224 console S Jun 03 0:00 /usr/lib/saf/ttymoroot 8980 0.0 0.3 1568 1296 ? S Jun 04 0:00 in.telnetdroot 8982 0.0 0.5 2608 2200 pts/18 S Jun 04 0:00 login -p -d /dev/pburt 8983 0.0 0.2 1192 1016 pts/18 S Jun 04 0:00 -cshburt 9006 0.0 0.2 824 696 pts/18 S Jun 04 0:00 scriptburt 9007 0.0 0.2 896 720 pts/18 S Jun 04 0:00 scriptburt 9008 0.0 0.2 1192 1048 pts/20 S Jun 04 0:00 sh -iburt 9019 0.0 0.4 1952 1704 pts/20 S Jun 04 0:00 tcshburt 9030 0.0 0.2 1192 1040 pts/20 S Jun 04 0:00 /bin/cshjiao 10004 0.0 0.2 848 744 pts/11 S 10:05:34 0:00 grep Junroot 10346 0.0 0.3 1568 1104 ? S Jun 01 0:00 in.telnetdroot 10348 0.0 0.4 2560 1832 pts/5 S Jun 01 0:00 login -p -d /dev/proot 12220 0.0 0.3 1552 1256 ? S Jun 02 0:00 in.rlogindroot 12222 0.0 0.5 2608 2160 pts/32 S Jun 02 0:00 login -d /dev/pts/ykatsn1 9520 0.0 0.2 920 664 ? S Jun 01 0:00 /bin/sh /usr/localykatsn1 9522 0.0 0.418912 1864 ? S Jun 01 0:00 (dns helper)ykatsn1 9550 0.0 0.2 920 696 ? S Jun 02 0:00 /bin/sh /usr/localykatsn1 9553 0.0 0.418920 2008 ? S Jun 02 0:00 (dns helper)

  13. actaeon.cs.umbc.edu[114] toplast pid: 10096; load averages: 1.01, 1.03, 1.03 10:19:54117 processes: 115 sleeping, 1 running, 1 on cpuCPU states: 0.0% idle, 97.4% user, 2.6% kernel, 0.0% iowait, 0.0% swapMemory: 512M real, 66M free, 129M swap in use, 371M swap freerenice 5 9521PID USER THR PRI NICE SIZE RES STATE TIME CPU COMMAND9521 ykatsn1 1 -15 0 22M 3432K run 138.0H 96.54% netscape 9551 ykatsn1 1 33 0 34M 22M sleep 65:23 1.44% netscape10096 jiao 1 27 0 1584K 1480K cpu 0:00 0.99% top 9499 crowder 1 33 0 4512K 3072K sleep 0:01 0.05% pine 5263 root 1 33 0 1584K 880K sleep 1:15 0.01% rpc.nisd_resolv 5262 root 1 33 0 3128K 1944K sleep 68:58 0.01% ypserv 115 root 1 33 0 2080K 1184K sleep 6:04 0.00% rpcbind 266 root 1 33 0 2552K 872K sleep 14:42 0.00% sshd125571 ykatsn1 5 34 0 39M 16M sleep 1:12 0.00% matlab 235 root 1 33 0 912K 440K sleep 1:10 0.00% utmpd 256 root 1 34 -12 2280K 608K sleep 1:04 0.00% xntpd 223 root 16 33 0 2912K 2336K sleep 0:49 0.00% nscd 3307 squiro 1 6 33 0 2512K 1760K sleep 0:31 0.00% windu_registryd 3411 squiro1 4 34 0 18M 3880K sleep 0:28 0.00% Medit 3706 squiro1 4 34 0 18M 3880K sleep 0:28 0.00% Medit

  14. Special attentions • NOHUP: Protect Background Process $ nohupcommand & • Errant Processes For more information, please refer to Chapter 29.

  15. Any Questions?

More Related