【Linux 内核】实时调度类 ② ( 实时调度实体 sched_rt_entity 源码分析 | run_list、timeout、watchdog_stamp、time_slice 字段 )
文章目錄
- 一、sched_rt_entity 源碼分析
- 1、run_list 字段
- 2、timeout 字段
- 3、watchdog_stamp 字段
- 4、time_slice 字段
- 5、back 字段
- 6、parent 字段
- 7、rt_rq 字段
- 8、my_q 字段
- 二、總結(jié)
一、sched_rt_entity 源碼分析
上一篇博客 【Linux 內(nèi)核】實(shí)時(shí)調(diào)度類 ① ( 進(jìn)程分類 | 實(shí)時(shí)進(jìn)程、普通進(jìn)程 | Linux 內(nèi)核 SCHED_FIFO、SCHED_RR 調(diào)度策略 | 實(shí)時(shí)調(diào)度實(shí)體 sched_rt_entity ) 引入了 實(shí)時(shí)調(diào)度實(shí)體 sched_rt_entity 結(jié)構(gòu)體源碼 , 在 Linux 內(nèi)核源碼的 linux-5.6.18\include\linux\sched.h 頭文件中 ;
下面開始分析該 實(shí)時(shí)調(diào)度實(shí)體 sched_rt_entity 結(jié)構(gòu)體源碼 ;
sched_rt_entity 結(jié)構(gòu)體 表示 " 實(shí)時(shí)調(diào)度實(shí)體 " 類型 ;
1、run_list 字段
sched_rt_entity 結(jié)構(gòu)體的 run_list 字段 , 是用于將 " 實(shí)時(shí)調(diào)度實(shí)體 " 加入到 優(yōu)先級(jí)隊(duì)列 中的 ;
struct list_head run_list;2、timeout 字段
sched_rt_entity 結(jié)構(gòu)體的 timeout 字段 , 用于 設(shè)置 調(diào)度 超時(shí)時(shí)間 ;
unsigned long timeout;3、watchdog_stamp 字段
sched_rt_entity 結(jié)構(gòu)體的 watchdog_stamp 字段 , 用于 記錄 jiffies 的值 ;
unsigned long watchdog_stamp;4、time_slice 字段
sched_rt_entity 結(jié)構(gòu)體的 time_slice 字段 , 表示 時(shí)間片 ;
unsigned int time_slice;5、back 字段
sched_rt_entity 結(jié)構(gòu)體的 back 字段 , 用于 由上到下 連接 " 實(shí)時(shí)調(diào)度實(shí)體 " ;
struct sched_rt_entity *back;6、parent 字段
sched_rt_entity 結(jié)構(gòu)體的 parent 字段 , 指向 父類 " 實(shí)時(shí)調(diào)度實(shí)體 " ;
struct sched_rt_entity *parent;7、rt_rq 字段
sched_rt_entity 結(jié)構(gòu)體的 rt_rq 字段 , 表示 " 實(shí)時(shí)調(diào)度實(shí)體 " 所屬的 " 實(shí)時(shí)運(yùn)行隊(duì)列 " ;
/* rq on which this entity is (to be) queued: */struct rt_rq *rt_rq;8、my_q 字段
sched_rt_entity 結(jié)構(gòu)體的 my_q 字段 , 表示 " 實(shí)時(shí)調(diào)度實(shí)體 " 所擁有的 " 實(shí)時(shí)運(yùn)行隊(duì)列 " , 用于管理 " 子任務(wù) " ;
/* rq "owned" by this entity/group: */struct rt_rq *my_q;二、總結(jié)
實(shí)時(shí)調(diào)度實(shí)體 sched_rt_entity 源碼注釋 :
struct sched_rt_entity {struct list_head run_list; // 用于將 " 實(shí)時(shí)調(diào)度實(shí)體 " 加入到 優(yōu)先級(jí)隊(duì)列 中的unsigned long timeout; // 用于 設(shè)置 調(diào)度 超時(shí)時(shí)間unsigned long watchdog_stamp; // 用于 記錄 jiffies 的值unsigned int time_slice; // 時(shí)間片unsigned short on_rq; unsigned short on_list;struct sched_rt_entity *back; // 用于 由上到下 連接 " 實(shí)時(shí)調(diào)度實(shí)體 " #ifdef CONFIG_RT_GROUP_SCHEDstruct sched_rt_entity *parent; // 指向 父類 " 實(shí)時(shí)調(diào)度實(shí)體 "/* rq on which this entity is (to be) queued: */struct rt_rq *rt_rq; // 表示 " 實(shí)時(shí)調(diào)度實(shí)體 " 所屬的 " 實(shí)時(shí)運(yùn)行隊(duì)列 " /* rq "owned" by this entity/group: */struct rt_rq *my_q; // 表示 " 實(shí)時(shí)調(diào)度實(shí)體 " 所擁有的 " 實(shí)時(shí)運(yùn)行隊(duì)列 " , 用于管理 " 子任務(wù) " #endif } __randomize_layout;總結(jié)
以上是生活随笔為你收集整理的【Linux 内核】实时调度类 ② ( 实时调度实体 sched_rt_entity 源码分析 | run_list、timeout、watchdog_stamp、time_slice 字段 )的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【错误记录】FFmpeg 推流报错 (
- 下一篇: 【Linux 内核】实时调度类 ③ (