[noyau Linux] classe de planification en temps réel ② (analyse du code source de l'entité de planification en temps réel sched_rt_entity | champs run_list, timeout, watchdog_stamp, time_slice)





1. Analyse du code source sched_rt_entity



Le dernier blog [noyau Linux] classe d'ordonnancement en temps réel ① (classification des processus | processus en temps réel, processus ordinaire | noyau Linux SCHED_FIFO, stratégie d'ordonnancement SCHED_RR | entité d'ordonnancement en temps réel sched_rt_entity) présente le code source de la sched_rt_entitystructure , dans l'en- linux-5.6.18\include\linux\sched.htête du fichier de code source du noyau Linux ;

Commençons par analyser le sched_rt_entity code source de la structure d'entité de planification en temps réel ;


sched_rt_entityLa structure représente le type « entité de planification en temps réel » ;


1. champ run_list


sched_rt_entityLe run_listchamp est utilisé pour ajouter "l'entité de planification en temps réel" à la file d'attente prioritaire ;

struct list_head		run_list;

2. champ de temporisation


sched_rt_entityLe timeoutchamp , utilisé pour définir le délai d'expiration de la planification ;

unsigned long			timeout;

3. champ watchdog_stamp


sched_rt_entityLe watchdog_stampchamp sert à enregistrer la valeur de jiffies ;

unsigned long			watchdog_stamp;

4. champ time_slice


sched_rt_entityUn time_slicechamp , représentant une tranche de temps ;

unsigned int			time_slice;

5. champ arrière


sched_rt_entitybackChamps de la structure , utilisés pour connecter les "entités de planification en temps réel" de haut en bas ;

struct sched_rt_entity		*back;

6. champ parent


sched_rt_entityLe parentchamp , pointant vers la classe mère "entité de planification en temps réel" ;

struct sched_rt_entity		*parent;

7. Champ rt_rq


sched_rt_entityLe rt_rqchamp , indiquant la « file d'attente d'exécution en temps réel » à laquelle appartient « l'entité de planification en temps réel » ;

	/* rq on which this entity is (to be) queued: */
	struct rt_rq			*rt_rq;

8. champ my_q


sched_rt_entityLe my_qchamp représente la " file d'attente d'exécution en temps réel" détenue par "l' entité de planification en temps réel" , qui est utilisée pour gérer les "sous-tâches" ;

	/* rq "owned" by this entity/group: */
	struct rt_rq			*my_q;




2. Résumé



Entité de planification en temps réel Commentaires sur sched_rt_entityle code source :

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;

Je suppose que tu aimes

Origine blog.csdn.net/han1202012/article/details/123871539
conseillé
Classement