进程调度策略和进程优先级

article/2025/7/22 18:26:32

Linux 的进程调度策略进程优先级是操作系统为保证系统响应性、公平性和高性能所设计的关键机制。

进程调度策略

Linux 支持 两大类调度策略

  • 普通调度策略(CFS: Completely Fair Scheduler), 适用于大部分用户态进程。
  • 实时调度策略(Real-Time Scheduling Policies),** **使用在时间要求严格的任务(如工业控制、音频处理)中。

普通调度策略(非实时)

  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_NORMAL</font>**(即 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_OTHER</font>**
    • 默认策略,用于普通进程(非实时进程)。
    • 使用 完全公平调度器(CFS, Completely Fair Schedule) 动态分配 CPU 时间,基于进程的 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">nice</font>** 值调整权重,把处理器时间公平地分给每个进程。
    • 示例:大多数用户进程(如浏览器、文本编辑器)。
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_IDLE</font>**
    • 优先级最低,仅在系统空闲时运行(如后台维护任务)。

实时调度策略

  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_FIFO</font>**(First In Fisrst Out)
    • 先进先出,先调度先运行。
    • 无时间片限制,进程会一直运行直到主动让出 CPU 或更高优先级进程就绪。
    • 优先级范围:**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">1</font>**(最低)到 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">99</font>**(最高)。
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_RR</font>**(Round Robin)
    • 类似 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_FIFO</font>**,但每个进程分配固定时间片,进程用完时间片以后加入优先级对应运行队列的尾部,把处理器让给优先级相同的其它实时进程。
    • 优先级范围同 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_FIFO</font>**(1-99)。
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_DEADLINE</font>**
    • 基于任务的截止时间(Deadline)调度,适合实时性要求严格的任务。
    • 使用三个参数:运行时间**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">runtime</font>**、截至期限**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">deadline</font>**、周期**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">period</font>**。每个周期运行一次,在截至期限之前执行完,一次运行的时间长度是<font style="color:rgb(64, 64, 64);">runtime</font>
    • 内核需要开启 CONFIG_SCHED_DEADLINE 。

调度策略定义如下:

/** Scheduling policies*/
#define SCHED_NORMAL		0
#define SCHED_FIFO		1
#define SCHED_RR		2
#define SCHED_BATCH		3
/* SCHED_ISO: reserved but not implemented yet */
#define SCHED_IDLE		5
#define SCHED_DEADLINE		6

进程优先级

  • 限期进程的优先级比实时进程要高,实时进程的优先级比普通通进程要高。
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_DEADLINE</font>** > **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_FIFO</font>**/**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_RR</font>** > **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">SCHED_NORMAL</font>**
  • 限期进程的优先级是-1。
  • 实时进程的实时优先级是<font style="color:rgb(64, 64, 64);">1~99</font>优先级数值越大,表示优先级越高
  • 普通进程的静态优先级是<font style="color:rgb(64, 64, 64);">100~139</font>优先级数值越小,表示优先级越高。可通过修改nice值(即相对优先级,取值范围是 <font style="color:rgb(64, 64, 64);">-20~19</font>)改变普通进程的优先级,优先级等于<font style="color:rgb(64, 64, 64);">120</font>加上nice值。

进程描述符<font style="color:rgb(64, 64, 64);">task_struct</font>中,有4个成员和优先级相关:

struct task_struct {...int				prio;int				static_prio;int				normal_prio;unsigned int			rt_priority;...
};

相关解释如下表:

优先级限期进程实时进程普通进程
prio
动态优先级(数值越小,表示优先级越高)
大多数情况下prio等于normal_prio
特殊情况:优先级继承。如果进程a占有实时互斥锁,进程b正在等待锁,进程b的优先级比进程a的优先级高,那么把进程a的优先级临时提高到进程b的优先级,即进程a的prio值等于进程b的prio值。
static_prio
静态优先级
不适用,总是0不适用,总是0120+nice
数值越小,表示优先级越高。
初始化后通常不变。
normal_prio
进程的“标准化”优先级(数值越小,表示优先级越高),由调度类根据 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">static_prio</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">rt_priority</font>** 计算。
-1(MAX_DL_PRIO-199(MAX_RT_PRIO - 1)- rt_prioritystatic_prio
rt_priority
实时优先级
不适用,总是0实时进程的优先级,范围是1~99,数值越大,表示优先级越高。
仅对实时进程有效。
不适用,总是0
调度策略**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">static_prio</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">rt_priority</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">normal_prio</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">prio</font>**
SCHED_DEADLINE**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">0</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">0</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">-1</font>**(特殊值)优先级继承场景外,通常等于normal_prio
SCHED_FIFO/RR**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">0</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">1-99</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">100 - 1 - rt_priority</font>**
SCHED_NORMAL**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">100 + nice + 20</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">0</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">= static_prio</font>**

调度器如何使用优先级字段

  • prio:调度器根据该字段在红黑树中排序(普通任务)或链表(实时任务)中比较。
  • static_prio :用于计算普通进程的normal_prio
  • normal_prio
    • 在新建进程或任务状态切换时用于初始化 prio
    • 在进程唤醒后 prio 会从 normal_prio 恢复。
  • rt_priority:用于计算实时进程的normal_prio

内核normal_prio计算

normal_prio计算的核心代码如下:

/** __normal_prio - return the priority that is based on the static prio*/
static inline int __normal_prio(struct task_struct *p)
{return p->static_prio;
}/** Calculate the expected normal priority: i.e. priority* without taking RT-inheritance into account. Might be* boosted by interactivity modifiers. Changes upon fork,* setprio syscalls, and whenever the interactivity* estimator recalculates.*/
static inline int normal_prio(struct task_struct *p)
{int prio;if (task_has_dl_policy(p)) // SCHED_DEADLINE 任务prio = MAX_DL_PRIO-1;else if (task_has_rt_policy(p)) // 实时任务prio = MAX_RT_PRIO-1 - p->rt_priority;else                            // 普通任务prio = __normal_prio(p);return prio;
}

调度策略及优先级查询方法

测试代码如下

// gcc -o policy_prio_test policy_prio_test.c -pthread
// ※一定要在root下运行 ./policy_prio_test
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <sched.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/resource.h>  // for setpriority()volatile sig_atomic_t keep_running = 1;void signal_handler(int sig) {if (sig == SIGINT) {keep_running = 0;}
}// 设置线程属性(调度策略和优先级)
void set_thread_attr(pthread_attr_t *attr, int policy, int priority) {// 初始化线程属性pthread_attr_init(attr);// 设置调度策略(SCHED_FIFO/SCHED_RR/SCHED_OTHER)pthread_attr_setschedpolicy(attr, policy);// 设置优先级(仅对实时策略有效)if (policy == SCHED_FIFO || policy == SCHED_RR) {struct sched_param param;param.sched_priority = priority;pthread_attr_setschedparam(attr, &param);}// 明确指定使用自定义调度参数(不继承父线程)pthread_attr_setinheritsched(attr, PTHREAD_EXPLICIT_SCHED);
}// 普通线程函数(通过nice值调整优先级)
void *normal_thread_func(void *arg) {int nice_val = *(int *)arg;printf("Normal Thread (nice=%d) started. PID=%d, TID=%ld\n",nice_val, getpid(), (long)pthread_self());// 设置当前线程的nice值if (setpriority(PRIO_PROCESS, 0, nice_val) == -1) {perror("setpriority failed");}while (keep_running) {sleep(1);  // 模拟工作}printf("Normal Thread (nice=%d) exiting.\n", nice_val);return NULL;
}// 实时线程函数(优先级由属性设置)
void *rt_thread_func(void *arg) {printf("RT Thread started. PID=%d, TID=%ld\n",getpid(), (long)pthread_self());while (keep_running) {sleep(1);  // 模拟工作}printf("RT Thread exiting.\n");return NULL;
}int main() {signal(SIGINT, signal_handler);printf("Main process PID: %d\n", getpid());pthread_t threads[7];pthread_attr_t attrs[7];// 线程配置:类型 + 优先级/nice值struct {int policy;int priority;  // 对实时线程有效int nice;      // 对普通线程有效} thread_configs[7] = {{SCHED_OTHER, 0, 10},   // 普通线程1 (nice=10){SCHED_OTHER, 0, 0},    // 普通线程2 (nice=0){SCHED_OTHER, 0, -5},   // 普通线程3 (nice=-5){SCHED_FIFO,  80, 0},   // FIFO线程1 (优先级80){SCHED_FIFO,  90, 0},   // FIFO线程2 (优先级90){SCHED_RR,    70, 0},   // RR线程1 (优先级70){SCHED_RR,    60, 0}    // RR线程2 (优先级60)};// 创建所有线程for (int i = 0; i < 7; i++) {// 设置线程属性set_thread_attr(&attrs[i], thread_configs[i].policy, thread_configs[i].priority);// 创建线程int ret;if (thread_configs[i].policy == SCHED_OTHER) {ret = pthread_create(&threads[i], &attrs[i], normal_thread_func, &thread_configs[i].nice);} else {ret = pthread_create(&threads[i], &attrs[i], rt_thread_func, NULL);}if (ret != 0) {fprintf(stderr, "Failed to create thread %d: %s\n", i, strerror(ret));exit(EXIT_FAILURE);}}// 等待Ctrl+C信号while (keep_running) {pause();}// 清理线程printf("Shutting down...\n");for (int i = 0; i < 7; i++) {pthread_cancel(threads[i]);pthread_join(threads[i], NULL);pthread_attr_destroy(&attrs[i]);}return 0;
}

ps命令查询

# ps  -p 44353 -Lo tid,policy,pri,nice,rtprio,cmdTID POL PRI  NI RTPRIO CMD44353 TS   19   0      - ./policy_prio_test44354 TS    9  10      - ./policy_prio_test44355 TS   19   0      - ./policy_prio_test44356 TS   24  -5      - ./policy_prio_test44357 FF  120   -     80 ./policy_prio_test44358 FF  130   -     90 ./policy_prio_test44359 RR  110   -     70 ./policy_prio_test44360 RR  100   -     60 ./policy_prio_test
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">pri</font>** 列的值是经过转换的(<font style="color:rgb(64, 64, 64);">139 - prio</font>),非内核的 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">prio</font>** 原始值
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">pri</font>** 值越大优先级越高

top命令查询

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND44353 root      20   0   60020    620    536 S   0.0   0.0   0:00.00 policy_prio_tes44354 root      30  10   60020    620    536 S   0.0   0.0   0:00.02 policy_prio_tes44355 root      20   0   60020    620    536 S   0.0   0.0   0:00.02 policy_prio_tes44356 root      15  -5   60020    620    536 S   0.0   0.0   0:00.01 policy_prio_tes44357 root     -81   0   60020    620    536 S   0.0   0.0   0:00.02 policy_prio_tes44358 root     -91   0   60020    620    536 S   0.0   0.0   0:00.02 policy_prio_tes44359 root     -71   0   60020    620    536 S   0.0   0.0   0:00.02 policy_prio_tes44360 root     -61   0   60020    620    536 S   0.0   0.0   0:00.02 policy_prio_tes
  • **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">PR</font>** 列(优先级)是 **<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">ps</font>****<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">pri</font>** 的另一种表示方式,非内核原始值
  • **<font style="color:rgb(64, 64, 64);">PR</font>** 值越小优先级越高。

<font style="color:rgb(64, 64, 64);">chrt</font>命令查询

chrt主要用来查询实时进程的调度策略和优先级。查询到的优先级是task_truct中的rt_priority,对于普通进程,该值为0。

# chrt -p 44353
pid 44353's current scheduling policy: SCHED_OTHER
pid 44353's current scheduling priority: 0 // 普通进程,rt_priority值为0# chrt -p 44354
pid 44354's current scheduling policy: SCHED_OTHER
pid 44354's current scheduling priority: 0# chrt -p 44355
pid 44355's current scheduling policy: SCHED_OTHER
pid 44355's current scheduling priority: 0# chrt -p 44356
pid 44356's current scheduling policy: SCHED_OTHER
pid 44356's current scheduling priority: 0# chrt -p 44357
pid 44357's current scheduling policy: SCHED_FIFO
pid 44357's current scheduling priority: 80#  chrt -p 44358
pid 44358's current scheduling policy: SCHED_FIFO
pid 44358's current scheduling priority: 90#  chrt -p 44359
pid 44359's current scheduling policy: SCHED_RR
pid 44359's current scheduling priority: 70# chrt -p 44360
pid 44360's current scheduling policy: SCHED_RR
pid 44360's current scheduling priority: 60

/proc/<pid>/sched查询

/proc/<pid>/sched查询,查询到的值是task_struct中的prio

# cat /proc/44353/sched
policy_prio_tes (44353, #threads: 8)
-------------------------------------------------------------------
se.exec_start                                :      19758958.662391
se.vruntime                                  :        159031.419195
se.sum_exec_runtime                          :             0.509459
se.nr_migrations                             :                    0
nr_switches                                  :                    8
nr_voluntary_switches                        :                    3
nr_involuntary_switches                      :                    5
se.load.weight                               :              1048576
se.avg.load_sum                              :                46917
se.avg.runnable_sum                          :             24281477
se.avg.util_sum                              :             24076911
se.avg.load_avg                              :                 1023
se.avg.runnable_avg                          :                  515
se.avg.util_avg                              :                  513
se.avg.last_update_time                      :       19758958661632
se.avg.util_est.ewma                         :                  513
se.avg.util_est.enqueued                     :                  513
uclamp.min                                   :                    0
uclamp.max                                   :                 1024
effective uclamp.min                         :                    0
effective uclamp.max                         :                 1024
policy                                       :                    0 // SCHED_NORMAL
prio                                         :                  120
clock-delta                                  :                   14
mm->numa_scan_seq                            :                    0
numa_pages_migrated                          :                    0
numa_preferred_nid                           :                   -1
total_numa_faults                            :                    0
current_node=0, numa_group_id=0
numa_faults node=0 task_private=0 task_shared=0 group_private=0 group_shared=0# cat /proc/44358/sched
policy_prio_tes (44358, #threads: 8)
-------------------------------------------------------------------
se.exec_start                                :      27409364.575804
se.vruntime                                  :             8.999994
se.sum_exec_runtime                          :           107.209942
se.nr_migrations                             :                    0
nr_switches                                  :                 7652
nr_voluntary_switches                        :                 7652
nr_involuntary_switches                      :                    0
se.load.weight                               :              1048576
se.avg.load_sum                              :                47055
se.avg.runnable_sum                          :             11860176
se.avg.util_sum                              :             11857104
se.avg.load_avg                              :                 1024
se.avg.runnable_avg                          :                  252
se.avg.util_avg                              :                  252
se.avg.last_update_time                      :       19758958593024
se.avg.util_est.ewma                         :                    0
se.avg.util_est.enqueued                     :                    0
uclamp.min                                   :                 1024
uclamp.max                                   :                 1024
effective uclamp.min                         :                 1024
effective uclamp.max                         :                 1024
policy                                       :                    1 // SCHED_FIFO
prio                                         :                    9
clock-delta                                  :                   21
mm->numa_scan_seq                            :                    0
numa_pages_migrated                          :                    0
numa_preferred_nid                           :                   -1
total_numa_faults                            :                    0
current_node=0, numa_group_id=0
numa_faults node=0 task_private=0 task_shared=0 group_private=0 group_shared=0

参考资料

  1. Professional Linux Kernel Architecture,Wolfgang Mauerer
  2. Linux内核深度解析,余华兵
  3. Linux设备驱动开发详解,宋宝华
  4. linux kernel 4.12


※※※下面内容暂时先保留,后续删除



系统调用

每个进程都有一个内核栈

当运行应用程序的时候,调用fork()/vfork()/clone()函数就是系统调用;系统调用就是应用程序如何进入内核空间执行任务,程序使用系统调用执行一系列的操作:如何创建进程、文件IO等;

内核线程

内核线程是直接由内核本身启动的进程;它是独立运行在内核空间的进程,与普通用户进程区别在于内核线程没有独立的进程地址空间;task_struct结构里面mm指针设置为NULL,它只能运行在内核空间。

退出进程

进程主动终止:从main()函数返回,链接程序会自动添加到exit()系统调用;主动调用exit()系统函数;

进程被动终止:进程收到自己不能处理的信号,如SIGKILL等;

  1. 什么是限期进程,实时进程,普通进程?
  2. 内核调度策略,SCHED_BATCH,怎么个批量处理;SCHED_IDLE,使task以最低优先级选择CFS调度器来调度运行,这个又是什么意思?
  3. 调度器类、调度策略,是怎么关联起来的?
  4. SCHED_OTHER, 与SCHED_NORMAL、SCHED_BATCH、SCHED_IDLE是什么关系?

不应该是数值越小,优先级越高吗?

就这么个意思

是什么呢,从什么呢,然后什么呢,对不对

SMT,超线程

查看进程状态,包括绑核信息

cat /proc/pid/status

查看进程sleep时,kernel当前运行的函数

cat /proc/pid/wchan


http://www.hkcw.cn/article/EMEfXZKQGX.shtml

相关文章

「Java教案」Java程序的构成

课程目标 1&#xff0e;知识目标 能够按照Java标识符的命名规则&#xff0c;规范变量的命名。能够区分Java中的关键字与保留字。能够对注释进行分类&#xff0c;根据注释的用途合理的选择注释方式。 2&#xff0e;能力目标 能编写符合规范的标识符。能识别Java中的关键字和…

随记 配置服务器的ssl整个过程

第一步 先了解到这个公钥私钥服务器自己可以生成&#xff0c;但是没什么用&#xff0c;浏览器不会信任的&#xff0c;其他人访问不了。所以要一些中间机构颁布的证书才有用。 一般的服务器直接 安装 Certbot 和插件 //CentOS Nginx 用户&#xff1a; sudo yum install epe…

Spring Cloud 知识

Spring Cloud 知识 一. 服务注册与发现1. Eureka1. Eureka 的概念2. Eureka 的特点3. Eureka 的应用场景4. Eureka 的实现原理 2. Nacos1. Nacos 的概念2. Nacos 的特点3. Nacos 的应用场景4. Nacos 的实现原理1. 服务注册与发现&#xff1a;2. 配置管理&#xff1a;3. 一致性算…

半导体晶圆制造洁净厂房的微振控制方案-江苏泊苏系统集成有限公司

半导体晶圆制造洁净厂房的微振控制方案-江苏泊苏系统集成有限公司 微振控制在现行国家标准《电子工业洁净厂房设计规范》GB50472中有关微振控制的规定主要有&#xff1a;洁净厂房的微振控制设施的设计分阶段进行&#xff0c;应包括设计、施工和投产等各阶段的微振测试、厂房建…

《操作系统真相还原》——大战MBR

在开机的一瞬间&#xff0c;也就是接电的一瞬间&#xff0c;CPU 的 cs&#xff1a;ip 寄存器被强制初始化为 0xF000&#xff1a;0xFFF0。由于开机的时候处于实模式&#xff0c;再重复一遍加深印象&#xff0c;在实模式下的段基址要乘以16&#xff0c;也就是左移4位&#xff0c;…

【计算机网络】fork()+exec()创建新进程(僵尸进程及孤儿进程)

文章目录 一、基本概念1. fork() 系统调用2. exec() 系列函数 二、典型使用场景1. 创建子进程执行新程序2. 父子进程执行不同代码 三、核心区别与注意事项四、组合使用技巧1. 重定向子进程的输入/输出2. 创建多级子进程 五、常见问题与解决方案僵尸进程&#xff08;Zombie Proc…

Selenium操作指南(全)

&#x1f345; 点击文末小卡片&#xff0c;免费获取软件测试全套资料&#xff0c;资料在手&#xff0c;涨薪更快 大家好&#xff0c;今天带大家一起系统的学习下模拟浏览器运行库Selenium&#xff0c;它是一个用于Web自动化测试及爬虫应用的重要工具。 Selenium测试直接运行在…

Linux研学-入门命令

一 目录介绍 1 介绍 Linux与Windows在目录结构组织上差异显著&#xff1a;Linux采用树型目录结构&#xff0c;以单一根目录/为起点&#xff0c;所有文件和子目录由此向下延伸形成层级体系&#xff0c;功能明确的目录各司其职&#xff0c;使文件系统层次清晰、逻辑连贯&#xf…

GSR 手环能耗数据实测:STM32 与 SD NAND 的功耗优化成果

文章目录 卓越性能强化安全高效能效图形处理优势丰富集成特性模拟模块实时监控保障数据完整性提升安全性与可靠性测量原理采样率相关 在智能皮电手环及数据存储技术不断迭代的当下&#xff0c;主控 MCU STM32H750 与存储 SD NAND MKDV4GIL-AST 的强强联合&#xff0c;正引领行业…

PCIe-PCI、PCIe中断机制概述

PCI、PCIe中断概述 PCIe 中断机制在继承 PCI 传统中断&#xff08;INTx&#xff09;的基础上&#xff0c;引入了更高效的 MSI/MSI-X 方案&#xff0c;以提升设备性能并减少 CPU 轮询开销。以下是核心要点及技术演进&#xff1a; ⚙️ ​​一、PCIe 中断类型与演进​​ ​​IN…

知识图谱增强的大型语言模型编辑

https://arxiv.org/pdf/2402.13593 摘要 大型语言模型&#xff08;LLM&#xff09;是推进自然语言处理&#xff08;NLP&#xff09;任务的关键&#xff0c;但其效率受到不准确和过时知识的阻碍。模型编辑是解决这些挑战的一个有前途的解决方案。然而&#xff0c;现有的编辑方法…

建立连接后 TCP 请求卡住

大家读完觉得有意义记得关注和点赞&#xff01;&#xff01;&#xff01; 这篇文章描述了一个内核和BPF网络问题 以及故障排除步骤&#xff0c;这是一个值得深入研究的有趣案例 Linux 内核网络复杂性。 目录 1 故障报告 1.1 现象&#xff1a;概率健康检查失败 1.2 范围&am…

C++核心编程_赋值运算符重载

4.5.4 赋值运算符重载 c编译器至少给一个类添加4个函数 默认构造函数(无参&#xff0c;函数体为空) 默认析构函数(无参&#xff0c;函数体为空) 默认拷贝构造函数&#xff0c;对属性进行值拷贝 赋值运算符 operator, 对属性进行值拷贝 如果类中有属性指向堆区&#xff0c;做…

深度学习笔记25-RNN心脏病预测(Pytorch)

&#x1f368; 本文为&#x1f517;365天深度学习训练营中的学习记录博客&#x1f356; 原作者&#xff1a;K同学啊 一、前期准备 1.数据处理 import torch.nn.functional as F import numpy as np import pandas as pd import torch from torch import nn dfpd.read_csv(r&…

基于 HT for Web 轻量化 3D 数字孪生数据中心解决方案

一、技术架构&#xff1a;HT for Web 的核心能力 图扑软件自主研发的 HT for Web 是基于 HTML5 的 2D/3D 可视化引擎&#xff0c;核心技术特性包括&#xff1a; 跨平台渲染&#xff1a;采用 WebGL 技术&#xff0c;支持 PC、移动端浏览器直接访问&#xff0c;兼容主流操作系统…

CIO大会, AI课笔记手稿分享

能认真听课的CIO不多了 能认真听课的CIO还能记笔记的不多了 能认真听课的CIO还能记笔记的字写得好的不多了

stl三角面元文件转颗粒VTK文件

效果展示&#xff1a; import os import sys import json import argparse import numpy as np import pandas as pd import open3d as o3d from glob import globPARTICLE_RADIUS 0.025def stl_to_particles(objpath, radiusNone):if radius is None:radius PARTICLE_RADIU…

vue为什么点击两遍才把参数传递过去

先说一下场景&#xff0c;就是我把云服务器这个下拉选择框分别初始化之后&#xff0c;然后点击新建权限然后就打开了右侧的抽屉式的对话框&#xff0c;页面上那个文字信息是传递过来了。那个是正确的&#xff0c;但是我请求接口的时候&#xff0c;发现请求的接口的参数总是要慢…

NodeMediaEdge通道管理

NodeMediaEdge任务管理 简介 NodeMediaEdge是一款部署在监控摄像机网络前端中&#xff0c;拉取Onvif或者rtsp/rtmp/http视频流并使用rtmp/kmp推送到公网流媒体服务器的工具。 在未使用NodeMediaServer的情况下&#xff0c;或者对部分视频流需要单独推送的需求&#xff0c;也可…

2025年- H59-Lc167--207.课程表(拓扑排序、BFS)-需二刷--Java版

1.题目描述 2.思路 记录每门课程的前置课程数量&#xff0c;记录每门课程是哪些课程的前置课程。 &#xff08;1&#xff09;如果有向图中的拓扑图中存在环&#xff0c;则说明所有的课程是无法完成的。 &#xff08;2&#xff09;使用拓扑排序&#xff0c;在图中每个节点的入度…