Processes and Scheduled Tasks

Source: Internet
Author: User

today's computers use the CPU is generally multicore, and multiple processes running at the same time, a CPU can only run a single instruction, how to implement multiple processes simultaneously running this is an art. Implementing a variety of functions requires classifying processes, specifying the permissions of a process, and specifying a process to control other processes to ensure proper use of other process permissions.

A Process type

a process is a running program that needs to load the program into memory before the process runs, and then the CPU loads the instructions in the process to process the data. When the process finishes processing the data, it stops and delivers the data to other processes, and the delivery of the data may not be done by itself. The following is an example of a single-core CPU, the idea of multicore work is the same as a single core, but the complexity of the work is greater.

There are roughly three processes in Linux: control processes, processes that invoke other processes, and common processes:

The control process is divided into a variety, one is the kernel, then linux can only have processes running, At this point the kernel will need to specify a certain amount of time to run the process, the kernel would grab back the cpu cpu need Cpu The interrupt function, not described here. Another process of control, init ( centos6 systemd ( centos7 centos

Bash invokes other processes and processes that implement interactive functionality. Bash calls the process of other processes: copy itself into memory, then load the calling program into this memory, and the process is scheduled to execute.

Two process states
PS View status of the process ps[opthion]    u              show the owner of the process     a              Show terminal-related processes     x              Show background Processes     o              Options PID,  comm,  %cpu,  %mem,  state,  tty,  euser,  ruserVSZ:  Virtualmemory size, virtual memory set, linear memory rss: residentsize,  resident Memory Set stat: Process status     R:  running    s: interruptablesleeping    d:uninterruptable  sleeping    t: stopped    z: zombie    + :  foreground process     l:  multithreaded process     n: low-priority process     <:   High-priority process     s:&Nbsp;sessionleader, session (child process) initiator 
Pgrep [Options]pattern Lookup process-u uid:effective user, effective-u uid:real user, really initiates run command-T-terminal: The process associated with the specified terminal-L: Show process Name-A: Displays the full format of the process name-P PID: a command that displays the process information in real-time by the child process of the specified process Top,htop,glance,dstat statistics sum of various system information


Three-process management kill signal PID
Common signal: Man 7 signal1) SIGHUP: No need to close the process and let it reread Profile 2) SIGINT: Abort a running process; equivalent to CTRL+C9) SIGKILL: Kill a running process. SIGTERM: Terminating a running process) S Igcont: Continue running) SIGSTOP: Background hibernation


Skill Signal Name

The use of Good Kill is similar

process front and back conversion

The process is divided into foreground and background processes, the foreground running process can be placed in the background by CTRL + Z , put into the background after the process becomes a stopped state.

Jobs view the background process bg# make the background process run (#可以通过jobs查看) fg# back the background process to the foreground


Four Scheduled Tasks
At[option] TimeTIME: Define when to do at this task time hh:mm [Yyyy-mm-dd]noon, Midnight, Teatime (4pm) Tomorrownow+#{minutes,hours, Days, OR weeks}

Crond

/etc/crontab file # example of job definition:#  .---------------- minute  (0 - 59) # |   .------------- hour  ( 0 - 23) # |   |. ---------- day of month  (1 - 31) # |   |    &NBSP;|&NBSP:------- month  (1 - 12)  ORjan,feb,mar,apr ...# |   &NBSP;|&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;|&NBSP;|&NBSP---- day of week  (0 - 6) ( SUNDAY=0&NBSP;OR&NBSP;7)  ORsun,mon,tue,wed,thu,fri,sat# |   |      |    |     |# * * * * *  User-name command to beexecuted 

ordinary users can use the crontab command to define their own scheduled tasks, and the resulting files are located in /var/spool/cron/username.

Summarize

This section focuses on the definition and use of crontab, skillfully using top and dstat to determine the bottleneck of the network, then uses the PS to locate the problem, and uses the kill Solve the problem.


This article is from "Lao Wang Linux Journey" blog, please be sure to keep this source http://oldking.blog.51cto.com/10402759/1878979

Processes and Scheduled Tasks

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.