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