current position：Home>Linux system scheduler (4) -- use the chrt command to query and modify the process scheduler
Linux system scheduler (4) -- use the chrt command to query and modify the process scheduler
2022-09-23 09:32:12【The user 3147702】
In the last article, we covered the evolution of the linux scheduler:
In the last article, we know that after Linux version 2.6.23, Linux actually maintains a set of schedulers to achieve different scheduling needs, they are divided into four layers:
- DL scheduler: adopt sched_deadline strategy;
- RT scheduler: adopts sched_rr and sched_fifo strategies;
- CFS scheduler: uses sched_normal and sched_batch strategies;
- IDEL scheduler: adopts the sched_idle strategy.
So, how can we get our processes to be scheduled by different layers of schedulers?Then you need to use the very useful tool provided by linux -- chrt to achieve this. In this article, we will introduce the use of this command.
2. Introduction of chrt commandThe
chrt command is a low-level application instruction provided by linux. It can set some attributes of the process at runtime, and can also change the scheduling policy and scheduling priority.
It is used in the following ways:
$ chrt [options] -p [priority] pid
It seems to be very simple to use. The easiest way to use chrt is to query. In this scenario, you don't need to pass options and priority:
You can see that the priority of the process is 0, and the scheduling policy is SCHED_OTHER, which is the default policy, which is scheduled by the CFS scheduler based on the SCHED_NORMAL policy.
3. chrt help
chrt --help command, you can see the description of all parameters:
Actually, this set of instructions is pretty clear.
4. chrt options
There are five options for chrt options, which correspond to the five strategies of the four-layer scheduler introduced in the previous article:
- SCHED_DEADLINE: The strategy used by the DL scheduler for system use only, the user cannot choose;
- SCHED_FIFO: use the RT scheduler's sched_fifo strategy, first-in, first-out task queue;
- SCHED_RR: Use the sched_rr strategy of the RT scheduler to implement the scheduling algorithm with a polling mechanism;
- SCHED_OTHER: use the CFS scheduler's sched_other strategy, using the default time_sharing scheduling algorithm;
- SCHED_BATCH: Use the sched_batch strategy of the CFS scheduler to submit tasks and execute them in batches using the batch algorithm;
- SCHED_IDLE: Use the sched_idle policy of the IDLE scheduler.
5. chrt's priority
chrt -m command, you can view the user-selectable priority range under different chrt scheduling policies:
priority is a nice value that can affect the scheduling priority to a certain extent, although only two schedulers, SCHED_FIFO and SCHED_RR, allow us to specify, because the RT scheduler is implemented using the traditional O(1) scheduling algorithmBased on time slice scheduling policy.
author[The user 3147702],Please bring the original link to reprint, thank you.
The sidebar is recommended
- SSM framework JSON string passing problem
- AU software makes signals with different duty cycles
- [C++] Font file analysis (FreeType)
- Why is the output of the instantiated object .data different from that of the instantiated object .disp?
- Mybatis framework
- Scripting language compilation front-end algorithm notes
- Linux open source IM GGTalk 8.0 is released, which supports running on Tongxin UOS and Galaxy Kylin!
- Why use notepad to write java in cmd but can't run in eclisp
- [Cloud native] MySQL on k8s environment deployment
- Cloud Native Enthusiasts Weekly: Implementing PostgreSQL Observability with eBPF
guess what you like
He Xiaopeng: G9 is the last generation of smart cars before autonomous driving
Solidity lesson nine - events and inheritance
Why does Redis Cluster choose hash slots instead of consistent hashing?
What's New in Redis 7.0 What are Redis Functions?An artifact that can easily implement "complex atomic operations"!
Multi-process communication between linux (shared memory)
Java thread pool
The G9 that failed to go public may be the beginning of Xiaopeng's failure
Oracle database uses function DBMS_RANDOM to generate random number method
Spring of ssm framework: how to configure and create objects in xml
Configuration and use of search artifact fzf under Linux
- Linux process concept (on)
- Java Development Kit
- Does Youxuan Database Support Read-Write Separation Configuration?
- Detailed explanation of the wireless communication scheme between stacker and reclaimer and DCS
- Use openssl to convert pfx format certificate into key and crt under windows
- Implementation of optimistic locking in redis (code)
- C++ 'chain chain' do not forget @ must have a doubly linked list of echoes
- Demo of distributed lock based on redis (recursive retry)
- Demo of distributed lock based on redis (circular retry) (better than recursive retry)
- Luxury comparable to Porsche, Maybach!He Xiaopeng: Xiaopeng G9 will outsell Audi Q5 next year
- Can Elasticsearch query tree structures recursively?
- There is a problem with IDEA 2021 git submission, the branch name always has an exclamation mark Rebasing
- MySQL (1038, 'Out of sort memory, consider increasing server sort buffer size')
- Is Node.js the most influential server technology of the past decade?
- Huawei mobile phone Mate 50 goes on sale, Shuyuan Technology provides 5G communication shell; can run Android APP, Microsoft officially released the first major update of Win 11 | Geek Headlines...
- Create an ArrayList and a LinkedList respectively, filling this container with multiple instances of the Dog class.
- Than the size assignment, press enter to flash back
- Java multi-thread, from shallow to deep study
- Analysis of the principle of netty
- The ultra-detailed summary of the four types of database deduplication implementation solutions is worth collecting
- Vue Element + UI more pictures to the background
- Java --- JVM development history
- Video forensics based on android mobile phone
- Design patterns and seven design principles are not difficult
- Hive focus of big data interview (4)
- Loading order of classes modified by @component annotations in different environments
- Caught data and reptiles
- Why there are 8 digits in the first line after running the program
- The Xiaopeng G9, which is full of Sandian and intelligent technology, still has to fight with Weilai and ideals_Sohu Auto_Sohu.com
- [Java] abstract classes and interfaces
- Several ali to release the internal MySQL performance optimization rule notes