Process Control-ps, top

Source: Internet
Author: User

Tag:httpd   1.0   sig    occupancy    pts    sso    different    ifconf    instance    

Process Control PS, top view system kernel: # uname-r-n-a# cat/etc/redhat-release# lsb_release-d network card IP Address: # ifconfig# ping-c N (times) ip|hostname# SE tup|/etc/sysconfig/network-scripts/ifcfg-ethx# uptime# lastlog Process View: A process is running a program, or a running instance of an executable program that has been started. A process has its own life cycle and a variety of different states. Features: 1, independence, process is an independent entity in the system, it can have its own independent resources, each process has its own private address space. A user process does not have direct access to the address space of another process without the process itself permitting. 2. Dynamic, the difference between a process and a program is that the program is just a static set of instructions, and the process is a collection of instructions that are active in the system. A process has its own life cycle and a variety of different states. 3, concurrency, multiple processes can be executed concurrently on a single processor, and there is no interaction between multiple processes. Threads: Also known as lightweight processes, threads are the execution units of a process, and a process can have multiple threads. A thread does not own a resource, and it shares the resources owned by the process with other threads of the parent process. The execution of a thread is preemptive. Program: Binary file, static/bin/date,/usr/sbin/httpd,/usr/sbin/sshd,/usr/local/nginx/sbin/ngix process: It is the process of program running, dynamic, life cycle and running state. Process life cycle: The parent process replicates its own address space (fork) to create a new (child) process structure. Each new process is assigned a unique process ID (PID) that meets the requirements for tracking security. The PID and parent process IDs (PPID) are elements of the child process environment, and any process can create child processes, all of which are descendants of the first system process: child processes inherit the parent process's security identity, past and current file descriptors, port and resource privileges, environment variables, and program code. The child process may then exec its own program code. Typically, the parent process is in a sleep (sleeping) state while the child process is running. When a child process completes (exit) a signal request, at exit, the child process has closed or discarded its resource environment, the remainder is called Zombie Zombie. The parent process wakes up when the child process exits, cleans up the remaining structure, and then resumes execution of its own program code. Status of the process: R run S can interrupt sleep sleepd non-disruptive sleep t stop process Z Zombie process x Dead process "invisible" static viewing process--ps:ps: Used to view process information, powerful, usage is also more complex, the most commonly used parameters are: PS aux, ps-ef, ps-ely option: A: Displays all processes under the current terminal, including other users ' processes ; u: Displays details of the process owner, status, resource occupancy, etc. (note the difference between "-" and "none"). X: Shows the process without control terminal. Typically used with the A parameter, you can list more complete information. -E: Displays all processes. -F: Full output shows the parent-child relationship between processes-L: A longer, more detailed list of information about the PID; Note: Ps-aux differs from PS auxps aux:user PID%cpu%MEM VSZ RSS TTY STAT START time Comman Droot 1 0.0 0.1 19356 1432? Ss 19:41 0:03/sbin/init Description: User: Users running the process PID: Process ID%CPU:CPU occupancy%mem: Memory consumption vsz: Consuming virtual Memory RSS: Consuming actual memory-resident memory TTY: Terminal stat: Process state running Man PS (/state) R run S can interrupt sleep sleepd non-interruptible sleep t stop process Z Zombie process x dead Process the leader of the process SS, parent process s< < higher priority process SN n Lower priority process r+ + represents the foreground process group SL with Line Run Start: Process start time: Total CPU time of process command: Process file, process name PS aux--sort-%cpu|headauxf: Show parent-child relationship Axo: Custom display field # PS Axo user,pid,% CPU,%MEM,RSS,COMMAND|HEADPIDOF Process Name: View the pidpstree of the specified process: View the process tree Dynamic view process--top during the execution of top, you can also use the following key commands: H|? Help m sort by memory use p sort by CPU n Sort by the size of PID R to sort by inverse F custom display field 1 shows the logical number of CPUs for the current system T: Cumulative ordering of CPU time used by the process K: a signal to a PID (signal), The default value is signal 15r: reschedule a process's priority s: Change the time between two refreshes. The default is 5 seconds Q: Exit the program. Top command common options:-D: Can be followed by the number of seconds, specify every two times the screen informationThe interval between refreshes;-P: Specifies a process to monitor;-b-n: Executes the top command in batch mode. Data flow redirection is typically used to output processing results to a file; Top view first part: System overall statistics top-14:15:04 up min, 2 users, load average:0.25, 0.18, 0.12tasks:235 total, 1 running, 234 sleeping, 0 stopped, 0 zombiecpu (s): 8.9%us, 1.0%sy, 0.0%ni, 90.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%stmem:7 944064k Total, 746164k used, 7197900k free, 35724k buffersswap:1048568k total, 0k used, 1048568k free, 261492k cachedload average:0.86, 0.56, 0.78: Average load calculation method for the system in the last 1 minutes, 5 minutes, 15 minutes: Average load/Logical CPU Count view the number of physical CPUs #cat/proc/cpuinfo |grep "Physical ID" |sort |uniq|wc-l View the number of logical CPUs #cat/proc/cpuinfo |grep "Processor" |wc-l view CPU is a few cores #cat/proc/cpuinfo |grep "cores" |uniq in general, Number of physical CPUs x the number of cores per core should be equal to the number of logical CPUs, if not equal, indicates that the server's CPU supports Hyper-Threading technology Nice,renice The priority of the tuning process-the lower the number of 20 ~ 19 The higher the priority The system will change the existing process's nice level 1 to the process according to more CPU time. Use top to change the priority of the Nice level R adjustment process (Nice levels) (-20 high)---0---(19 low) 2. Use Shell to change nice level # Renice-* PID eg:# renice-20 10089 Process Control: Kill,killall,pkill,skill send signal to process # KILL-L list all supported signal number Signal name 1) SIGHUP Reload configuration 2) SIGINT keyboard interrupt ^c3) Sigquit keyboard exit 9) SIGKILL Strongsystem termination (normal end), the default signal (SIGTERM) Sigcont continue) SIGSTOP stop) SIGTSTP pause ^z# FG Put the last run in the background process again put in the terminal foreground # FG%1 back job 1 to the foreground # BG%2 Process with background number 2 resumes running status # w14:08:50 up 4:06, 5 users, Load average:0.25, 0.55, 0.70USER TTY from [email protected] IDLE jcpu PCPU Whatroot tty1:0 10:04 4:04m 12:48 12:48/usr/bin/xoroot pts/0:0.0 10:04 0.00s 38.47s 0.02s wroot pts/2:0.0 10:04 2:29m 0.07s 0.07s bashr Oot pts/3:0.0 10:04 3:41m 0.00s 0.00s bashroot pts/4 172.16.1.180 13:55 11:41 3:07 46.62s RSYNC-ALVR Description: User: Logged in username TTY: Login After system assigned terminal number from: remote host, that is, from where to log on [email protected]: When to log on idle: How long the idle time, indicating the user idle time. This is a timer that will be reset once the user performs any action. JCPU: CPU time consumed by all processes connected to the terminal (TTY), which does not include the past background job time, but includes the time taken by the currently running background job PCPU: Refers to the CPU time consumed by the current process (that is, the process shown in the what item). What: the command line of the process that is currently running.

Process Control-ps, top

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.