linux 性能调节指南

性能调节指南Red Hat Enterprise Linux 7

 Linux-kernel-notes

系统监视实用程序

深入理解Linux Kernel调度器的身世之谜

Linux进程管理(八)进程调度的调试

Linux进程调度器的设计--Linux进程的管理与调度  

深入理解Linux Kernel调度器的身世之谜   

深入linux内核架构--核心调度器 

Linux调度器基础   

A complete guide to Linux process scheduling   

Linux Doc

CFS Scheduler  

Code Go Through 

RT linux source Code -  sched_class identifier

Fixing SCHED_IDLE  

Elements in the Task Structure  

sched_class Struct Reference 3.7.1  

Understanding sched_class  

Policy define

#define SCHED_NORMAL 0
#define SCHED_FIFO 1
#define SCHED_RR 2
#define SCHED_BATCH 3
#define SCHED_IDLE 5

Processes under SCHED_NORMAL, SCHED_BATCH and SCHED_IDLE are mapped to fair_sched_class, provided by CFS. SCHED_RR and SCHED_FIFO associate with rt_sched_class, real-time scheduler.  (A complete guide to Linux process scheduling)

awk '/policy/ {print $NF}' /proc/*/sched |sort | uniq

PID=2911 awk '/policy/ {print $NF}' /proc/$PID/sched

chrt -ap $PID

what is the use of .next field in sched_class structure?

Linux Scheduler  

How to find scheduling policy and active processes' priority?

  • TS is SCHED_OTHER
  • RR is SCHED_RR
  • FF is SCHED_FIFO
ps -e -o s,pid,cls,pri | grep ^R | awk -v sq="'" '{print "pid",$2,sq,"s current scheduling policy:",$3,"\npid",$2,sq,"s current priority:",$4}'

ps -e -o s,pid | grep ^R | awk '{system("chrt -p " $2)}'

ls /proc | grep -e ^[0-9] | awk '{system("chrt -p " $0)}'|more

How to change scheduling algorithm and priority used by a process?

PID=7861 

tuna --threads $PID --priority=RR:40    # <<-- sets a policy of RR (round-robin) and a priority of 40 for PID 7861. 

 

How to check the process scheduling policy other than `ps` output

PID=25
awk '/policy/ {print $NF}' /proc/$PID/sched

 

Linux Kernel Development

It will be added a new scheduling policy to the CISTER framework. The scheduling algorithm is the well known Last-In First-Out (LIFO). According to LIFO scheduling algorithm, the last task ready for execution execution will be selected to be executed. That is, whenever a task arrives (become ready for execution) the currently executing is preempted and the recently arrived task is selected for execution.

 A set of steps is required to add a new scheduling policy. REF: http://www.cister.isep.ipp.pt/summer2017/w1/S3_Lab.pdf 

Note that, almost all functions have as arguments pointers of struct task_struct and struct rq. The lf_sched_class scheduling policy it is positioned between the RT and CFS scheduling classes.

 stop_sched_class 

The stop_sched_class is to stop cpu, using on SMP system, for load balancing and cpu hotplug. This class have the highest scheduling priority.

REF: https://stackoverflow.com/questions/15399782/what-is-the-use-of-stop-sched-class-in-linux-kernel/15423728 

 

The Linux Kernel Scheduler

 

 

linux-kernel-hacking

ch 04. Process Scheduling  

process-scheduling-in-linux

3 Scheduling Classes

Linux kernel scheduler

 

中文blog

linux内核调度:调度策略与调度器类

Linux进程及其调度策略  

Linux进程管理(三)进程调度相关概念   

高级程序员进阶:了解Linux I/O 调度器,优化系统性能  

一篇文章让你了解Linux进程调度器  

Linux 进程调度(6)- 调度策略 

sched linux调度 CFS

posted @ 2022-04-05 11:28  lvmxh  阅读(65)  评论(0编辑  收藏  举报