Processes and Scheduled Tasks
One: The concept of a process
★: A copy of a running program is a collection of instructions loaded into memory that executes a binary program on the operating system to produce a process.
★: Process id,pid number is used to mark individual processes
Two: The basic state and transformation of the process
III: Modalities for communication between IPC processes;
★: Same Host:
Signal: Signal
Shm:shared Memory
Semaphore: Signal volume, a counter
★: Different host:
Socket:ip and port number
Rpc:remote Procedure Call
MQ: Message Queuing, KAFKA,ACTIVEMQ
Lru:least Recently used uses least recent algorithms to free up memory
IV: Process Status
★: Process Type
Daemon: daemon, process initiated during system boot, and terminal-independent process
Foreground process: terminal-related, process initiated through terminal
★: Process Status
Operating state: Running
Ready state: Readiness
Sleep state:
Interruptible: interruptable
Non-disruptive: uninterruptable
Stop state: Stopped, paused in memory, but not dispatched unless manually started
Zombie State: Zombie, end process, child process does not close before parent process ends
★: Classification of the process
Cpu-bound:cpu intensive, non-interactive
Io-bound:io intensive, interactive
Watch-n 1 ' Ps-eo pid,ppid,cmd,%mem,%cpu--sort=-%mem | Head
V: Priority set of the process
Nice-n [ -20-19] +command process not running
Renice-n [ -20-19] +pid running process
★: Search Process
pgrep [Options] Pattern
-U uid:effective user, effective by
-U uid:real user, who actually initiates the run of the command
-T terminal: processes associated with the specified terminal
-L: Show process name
-A: Displays the process name in full format
-P PID: Displays the child processes of the specified process
Example Pgrep-l nginx:pgrep ". php"
★: System Tools
Uptime
Top
W
Losf
?-A: Lists the processes that exist for open files
?-c< process name;: Lists files opened by the specified process
? g: List GID process details
?-d< file number;: Lists the processes that occupy the file number
?+d< directory: List files opened in directory
?+d< directory: Recursively lists files that are open in the directory
?-n< directory;: List files that use NFS
?-i< conditions;: List eligible processes
?-p< Process Number: Lists files opened by the specified process number
?-u: List UID number process details
?-H: Display Help information
?-V: Displays version information.
?-N: Do not reverse parse network name
Common examples
View processes initiated by the logged-on user instead of the system
Lsof/dev/pts1
Specify the process number to view the files opened by the process
Lsof-p 9527
File Management
View files opened by the specified program
Lsof-c httpd
View files opened by a specified user
Lsof-u Root | More
View files opened under the specified directory
Recover deleted files with LOSF
Lsof |grep/var/log/messages
Rm-f/var/log/messages
Lsof |grep/var/log/messages
Cat/proc/653/fd/6
CAT/PROC/653/FD/6 >/var/log/messages
Process management Tools
Kill + Option +pid
1) SIGHUP: No need to close the process and let it reread the configuration file
2) SIGINT: Abort the running process, equivalent to CTRL + C
3) Sigquit: equivalent to Ctrl+\
9) SIGKILL: Force kills a running process
SIGTERM: Terminating a running process
Sigcont: Continue Running
SIGSTOP: Background hibernation
Commonly used and pkill are similar to killall usage.
Pkill + signal + process name as
Pkill-9 Nginx
Pkill-9-T Tty1 kick terminal
VI.: Job Management
Let the job run in the background
(1) Operation: Ctrl + Z in the background and stop running
(2) Jobs that have not been started: COMMAND & run in the background
Job Control: Jobs can view background jobs
FG [[%]job_num]: Returning the specified background job to the foreground
BG [[%]job_num]: Allow jobs sent to the background to continue running in the background
Kill [%job_num]: terminates the specified job
Run in parallel
Run multiple processes at the same time for increased efficiency
? Method 1
VI all.sh
f1.sh&
f2.sh&
f3.sh&
? Method 2
(f1.sh&);(f2.sh&);(f3.sh&)
? Method 3
{f1.sh& f2.sh& f3.sh&}
Parallel probing network host is online:
Seven: Recurring Task Scheduler cron (package name Cronie)
Example of job definition:.----------------minute (0-59) |.-------------Hour (0-23) | |.----------DAY OF month (1- | | |.-------month (1-12) OR jan,feb,mar,apr ... | | | |.----DAY of Week (0-6) (sunday=0 or 7) or sun,mon,tue,wed,thu,fri,sat| | | | |
* user-name command to be executed
Export Editor=vim crontab Ribbon Color
Processes and Scheduled Tasks