2026/5/18 12:40:38
网站建设
项目流程
php怎么做搭建网站,wordpress 媒体文件夹,wordpress 动作钩子,做微商那个网站好接前一篇文章#xff1a;Linux CFS#xff08;完全公平调度器#xff09;原理与实现细节全解析#xff08;1#xff09; 二、核心概念与关键抽象
2.2 调度实体#xff08;sched_entity#xff09;
CFS的调度基本单位不是传统的task_struct#xff0c;而是更通用的抽象…接前一篇文章Linux CFS完全公平调度器原理与实现细节全解析1二、核心概念与关键抽象2.2 调度实体sched_entityCFS的调度基本单位不是传统的task_struct而是更通用的抽象 ——调度实体struct sched_entity。设计原因很简单有时调度对象是单个进程/线程有时调度对象是任务组task group或cgroup希望在“调度层”统一地处理这些对象而不关心其内部构成。因此普通进程task_struct中内嵌一个struct sched_entity任务组task_group中也内嵌一个struct sched_entityCFS的核心调度逻辑只围绕sched_entity展开。其关键字段如下节选// include/linux/sched.h struct sched_entity { /* For load-balancing: */ struct load_weight load; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; u64 exec_start; u64 sum_exec_runtime; u64 vruntime; u64 prev_sum_exec_runtime; u64 nr_migrations; #ifdef CONFIG_FAIR_GROUP_SCHED struct sched_entity *parent; /* rq on which this entity is (to be) queued: */ struct cfs_rq *cfs_rq; /* rq owned by this entity/group: */ struct cfs_rq *my_q; #endif };其中load任务权重及其倒数等信息由nice值通过sched_prio_to_weight映射而来。vruntime虚拟运行时间是CFS调度排序的核心字段。run_node作为红黑树节点使得该实体可插入CFS运行队列的rb-tree中。cfs_rq/my_q/parent在启用组调度时构建层次化调度树cfs_rq该实体所属运行队列。my_q如果该实体本身代表一个任务组则它拥有自己的子运行队列my_q。parent父级调度实体实现自上而下的嵌套调度。这种设计将“调度逻辑”与“被调度对象”解耦使CFS可以自然支持从单进程到多级cgroup的复杂层次结构。更多内容请看下回。