Topic 3.3 Process Management

6 4 0
Topic 3.3 Process Management

Đang tải... (xem toàn văn)

Thông tin tài liệu

Triển khai một máy tính làm việc Linux với các tính năng về đồ họa, vi tính văn phòng,… Hệ thống vận hành: cài đặt, cấu hình, quản trị, xử lý sự cố,… Vận hành hệ điều hành Linux: cài đặt, cấu hình mạng, máy trong, sử dụng thành thạo các công cụ quản lý mạng, cấu hình nhân, DFS, lập kế hoạch cho việc lưu trữ và phục hồi dữ liệu, TCP IP , config device,… Liên kết cơ bản kỹ năng đến Internet: kết nối, email, bảo mật, DNS, Apache, SSH, NTP,…

1 Theo dõi tiến trình Tạo user nv1, nv2 Quản lý tiến trình ps -ax xem thơng tin tất tiến trình PID: process ID PPID: Parent process ID PROCESS STATE CODES Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process D Uninterruptible sleep (usually IO) R Running or runnable (on run queue) S Interruptible sleep (waiting for an event to complete) T Stopped, either by a job control signal or because it is being traced W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z Defunct ("zombie") process, terminated but not reaped by its parent For BSD formats and when the stat keyword is used, additional characters may be displayed: < high-priority (not nice to other users) N low-priority (nice to other users) L has pages locked into memory (for real-time and custom IO) s is a session leader l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do) + is in the foreground process group Alt+f2 login root #ps -ef | more xem tiến trình cha, Ý nghĩa cột ■ UID: The user responsible for launching the process ■ PID: The process ID of the process ■ PPID: The PID of the parent process (if a process is started by another process) ■ C: Processor utilization over the lifetime of the process ■ STIME: The system time when the process started ■ TTY: The terminal device from which the process was launched ■ TIME: The cumulative CPU time required to run the process ■ CMD: The name of the program that was started xem thơng tin tiến trình theo cấu trúc cây: pstree -np | more [root@localhost ~]# pstree -np | more init(1)-+-udevd(415)-+-udevd(1740) | `-udevd(1742) |-auditd(1248) -{auditd}(1249) |-rsyslogd(1264)-+-{rsyslogd}(1267) | `-{rsyslogd}(1268) |-rpcbind(1306) |-dbus-daemon(1321) -{dbus-daemon}(1324) |-NetworkManager(1333) |-modem-manager(1339) |-avahi-daemon(1345) -avahi-daemon(1346) |-rpc.statd(1363) |-wpa_supplicant(1428) |-rpc.idmapd(1429) 70 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ |-acpid(1443) |-hald(1452) -hald-runner(1453)-+-hald-addon-inpu(1493) | `-hald-addon-acpi(1499) Theo dõi tiền trình login u1, u2 Alt+F2, login u1; Alt+F3, login u3; chạy mc chạy mc [root@localhost ~]# pstree -np | more ………………………………………… |-abrtd(1650) |-abrt-dump-oops(1658) |-qpidd(1669)-+-{qpidd}(1670) | `-{qpidd}(1671) |-crond(1707) |-atd(1718) |-login(1731) -bash(2024) -pstree(2250) |-login(1733) -bash(2057) -mc(2089)-+-cons.saver(2090) | `-bash(2091) |-login(1735) -bash(2115) -mc(2227)-+-cons.saver(2228) | `-bash(2229) Hoặc: [root@localhost ~]# pstree -nup | more ps -u u1 xem thông tin tiến trình u1 khởi tạo [root@localhost ~]# ps -u u1 PID TTY TIME CMD 2057 tty2 00:00:00 bash 2089 tty2 00:00:00 mc 2090 ? 00:00:00 cons.saver 2091 pts/5 00:00:00 bash Hủy tiến trình theo PID kill PID [root@localhost ~]# pkill 2089 # 2089 PID mc u1 khởi rạo Hủy tiến trình theo tên pkill named killall processes by name [root@localhost ~]# pkill mc Lệnh killall: dùng muốn kill tất process với tên chắn Lúc không cần dùng ps để tìm PID Ví dụ: # killall httpd [root@localhost ~]# pgrep sendmail [root@localhost ~]# pkill sendmail [root@localhost ~]# pgrep sendmail khởi động lại sendmail [root@localhost ~]# service sendmail start #tìm pid sendmail #hủy tiến trình sendmail #tìm pid sendmail Nhận dạng tiến trình Tiến trình tiền cảnh: user tạo giao tiếp trực tiếp với user vd: mc Tiến trình hậu cảnh: (deamon process) - người dùng tạo - hệ thống tạo ra, tự động kích hoạt Đưa tiến trình vào hậu cảnh - Chạy mc, nhấn Ctrl+Z Hoặc thêm & vào sau câu lệnh [root@localhost ~]# sleep 1000 & [root@localhost ~]# sleep 1500 & Xem tiến trình hậu cảnh [root@localhost ~]# jobs [1]+ Stopped mc [2] Running sleep 1000 & [3]- Running sleep 1500 & Lệnh bg %n Lệnh fg %n : chạy tính trình hậu cảnh : đưa tiến trình tiền cảnh Theo dõi performance hệ thống Lệnh top Key Switches For The Top Command: -h - Show the current version -c - This toggles the command column between showing command and program name -d - Specify the delay time between refreshing the screen -o - Sorts by the named field -p - Only show processes with specified process IDs -u - Show only processes by the specified user -i - Do not show idle tasks 72 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ Xem thông số CPU: us percent cpu being used by userland code sy percent cpu being used by kernelspace code ni like "us" but related to "niced" processes id idle wa cpu is idle because it waits for IO to complete hi interrupts generated by hardware si interrupts generated by software Các trạng thái: w: S Process Status The status of the task which can be one of: 'D' = uninterruptible sleep 'R' = running 'S' = sleeping 'T' = traced or stopped 'Z' = zombie Ý nghĩa cột PID: The process ID of the process USER: The user name of the owner of the process PR: The priority of the process NI: The nice value of the process VIRT: The total amount of virtual memory used by the process RES: The amount of physical memory the process is using SHR: The amount of memory the process is sharing with other processes S: The process status (D = interruptible sleep, R = running, S = sleeping, T = traced or stopped, or Z = zombie) %CPU: The share of CPU time that the process is using %MEM: The share of available physical memory the process is using TIME+: The total CPU time the process has used since starting COMMAND: The command line name of the process (program started) Xuất kết lệnh top file: top -cSb -n > proc.txt Có thể sử dụng tiện ích htop để xem kiểm sốt tiến trình 74 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ ... launching the process ■ PID: The process ID of the process ■ PPID: The PID of the parent process (if a process is started by another process) ■ C: Processor utilization over the lifetime of the process. .. = zombie Ý nghĩa cột PID: The process ID of the process USER: The user name of the owner of the process PR: The priority of the process NI: The nice value of the process VIRT: The total amount... virtual memory used by the process RES: The amount of physical memory the process is using SHR: The amount of memory the process is sharing with other processes S: The process status (D = interruptible

Ngày đăng: 27/09/2022, 02:23

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan