Linux Optimization Process Chapter

Source: Internet
Author: User

Process classifications in Linux systems:

Interactive process (IO-intensive)

Batch process (CPU intensive)

Real-time process (daemon)

Balanced process IO-intensive and CPU-intensive methods:

High priority for IO-intensive: Short CPU time slices

For CPU-intensive: time slices are longer, with lower priority


Process Priority :

Divided into real-time process priority, static process priority, dynamic process priority

Real-time Process priority: 1-99 (the smaller the number, the lower the priority), typically the process associated with the system kernel

Static priority: 100-139 (the smaller the number, the higher the priority), which is generally the process of user-space

Real-time process priority is higher than static priority

Dynamic priority: When a process is not running for a long time, the kernel temporarily prioritizes the process;

When the process is too resource-intensive, the priority is lowered. (The object is typically 100-139 of the process)


To adjust the process priority level:

When a process is created, its default priority is 120, at which point the Nice value is 0,nice with a value range of 20 to 19, and a total of 40 levels. The smaller the value, the higher the process priority, and the higher the value, the lower the priority. You can change the nice value of a process that will be executed with the nice command, or modify the nice value of the executing process through the Renice command

Nice-n bash #将bash的nice值修改为10 with a priority of 130renice 5 bash #将正在运行中的bash进程的nice值加5


scheduling policy for the process :

When the priority of two processes is the same, a certain scheduling policy is required

Real-time process scheduling policy:

Sched_fifo: In the first-in-one-out queue scheduling, in the same priority situation, who first executed the

Who is dispatched first unless it exits or actively releases the CPU.

SCHED_RR: Multiple processes of the same priority are processed in a time-slice rotation.

Non-real-time process scheduling policy:

Sched_other, Sched_idle


To view and set scheduling policies for a process using the CHRT command

Usage: chrt [options]-P [Specify priority] PID

Options

-F Scheduler set to Sched_fifo

-O Scheduler set to Sched_other

-R Scheduler set to SCHED_RR

[Email protected] ~]# chrt-p 34735 #查看pid为34735的进程属性pid 34735 ' s current scheduling policy:sched_otherpid 34735 ' s cur Rent scheduling priority:0
# chrt-f-P #将PID 1000 process is set to SCHED_FIFO, with priority set to 50. # Chrt-o-P 0 #将PID 1000 process is set to Sched_other with priority set to 0. # chrt-f 50/bin/test.sh #启动/bin/test.sh set to Sched_fifo, priority set to 50

This article is from the "a" blog, please make sure to keep this source http://lzs66.blog.51cto.com/9607068/1856320

Linux Optimization Process Chapter

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.