您当前的位置: 首页 >  linux

韩曙亮

暂无认证

  • 2浏览

    0关注

    1068博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【Linux 内核】实时调度类 ② ( 实时调度实体 sched_rt_entity 源码分析 | run_list、timeout、watchdog_stamp、time_slice 字段 )

韩曙亮 发布时间:2022-03-31 19:00:12 ,浏览量:2

文章目录
  • 一、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_SCHED
	struct 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;
关注
打赏
1663594092
查看更多评论
立即登录/注册

微信扫码登录

0.2583s