当前位置: 首页 > news >正文

移动开发和网站开发注册城乡规划师考试题型

移动开发和网站开发,注册城乡规划师考试题型,建设网站需要公司吗,做国外网站set_user_nice set_user_nice函数功能:设置某一进程的NICE值,其NICE值的计算是根据进程的静态优先级(task_struct->static_prio),直接通过set_user_nice函数更改进程的静态优先级。 内核源码 void set_user_nice…

set_user_nice

set_user_nice函数功能:设置某一进程的NICE值,其NICE值的计算是根据进程的静态优先级(task_struct->static_prio),直接通过set_user_nice函数更改进程的静态优先级。

内核源码

void set_user_nice(struct task_struct *p, long nice)
{bool queued, running;int old_prio;struct rq_flags rf;struct rq *rq;if (task_nice(p) == nice || nice < MIN_NICE || nice > MAX_NICE)return;/** We have to be careful, if called from sys_setpriority(),* the task might be in the middle of scheduling on another CPU.*/rq = task_rq_lock(p, &rf);update_rq_clock(rq);/** The RT priorities are set via sched_setscheduler(), but we still* allow the 'normal' nice value to be set - but as expected* it wont have any effect on scheduling until the task is* SCHED_DEADLINE, SCHED_FIFO or SCHED_RR:*/if (task_has_dl_policy(p) || task_has_rt_policy(p)) {p->static_prio = NICE_TO_PRIO(nice);goto out_unlock;}queued = task_on_rq_queued(p);running = task_current(rq, p);if (queued)dequeue_task(rq, p, DEQUEUE_SAVE | DEQUEUE_NOCLOCK);if (running)put_prev_task(rq, p);p->static_prio = NICE_TO_PRIO(nice);set_load_weight(p, true);old_prio = p->prio;p->prio = effective_prio(p);if (queued)enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);if (running)set_next_task(rq, p);/** If the task increased its priority or is running and* lowered its priority, then reschedule its CPU:*/p->sched_class->prio_changed(rq, p, old_prio);out_unlock:task_rq_unlock(rq, p, &rf);
}
EXPORT_SYMBOL(set_user_nice);

使用示例

#include <linux/module.h>
#include <linux/pid.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kthread.h>static int MyThreadFunc(void* argc) {printk("Prompt:kernel thread PID : %d.\n", current->pid);printk("Prompt:kernel thread static_prio : %d.\n", current->static_prio);printk("Prompt:kernel thread nice : %d.\n", task_nice(current));return 0;
}static int __init SetUserNiceInit(void) {struct task_struct* new_task = NULL;new_task = kthread_create_on_node(MyThreadFunc, NULL, -1, "setusernice.c");printk("Prompt:new thread nice : %d.\n", task_nice(new_task));printk("Prompt:new thread static_prio : %d.\n", new_task->static_prio);printk("Prompt:new thread prio : %d.\n", new_task->prio);set_user_nice(new_task, 16);printk("Prompt:new thread nice : %d.\n", task_nice(new_task));printk("Prompt:new thread static_prio : %d.\n", new_task->static_prio);printk("Prompt:new thread prio : %d.\n", new_task->prio);return 0;
}static void __exit SetUserNiceExit(void) {printk("Prompt:exit kernel.\n");
}module_init(SetUserNiceInit);
module_exit(SetUserNiceExit);

运行结果

http://www.yayakq.cn/news/796855/

相关文章:

  • 网站建设自我评价怎么写比较好企业网站建设的策略
  • 东莞市建设安监监督网站首页多米诺网站建设服务
  • 珠海网站开发定制江苏省住房与城乡建设部网站
  • 英文公司网站设计asp网站后台编辑器
  • wordpress做微信支付河南网站推广优化公司
  • 医疗网站建设公司哪家好大连seo推广优化
  • 网上书城网站开发的数据字典腾讯云 wordpress搭建个人博客
  • 松江新桥网站建设js网页特效案例
  • t型布局网站的优缺点做网站优化词怎么选择
  • 电脑做系统ppt下载网站好做门户网站要多少钱
  • 岳阳网站建设解决方案搭建网站的价格
  • 江门做公司网站C语言做网站需要创建窗口吗
  • 网站建设趋势2017小程序代理好做吗
  • 江苏省工程建设标准定额网站自己装修设计软件
  • 新网网站建设个人怎么创建网站
  • 怎么做投资网站不违法普洱建设工程网站
  • 下列软件属于网站开发工具的是产品创意设计
  • 网站做快速排名是怎么做的呢网站服务器和直播服务器一样吗
  • 徐州住房与建设局网站苏州建设工程招标官方网站
  • 建网站软件工具门户网站如何做seo
  • 温州网站建设公司排名seo怎么优化软件
  • 怎么写网站建设维护推广合同广东龙盛建设工程有限公司
  • 网站空间购买哪个好广州建设工程交易中心电话
  • 唐山市路桥建设有限公司网站公司查询网
  • 安嶶省城乡建设网站佛山企业网站排名
  • 石家庄整站优化互联网技术类岗位有哪些
  • 网站vps被黑房产经纪人如何做网站吸客
  • 电子商务都是做网站的吗php网站开发教材
  • 巩义做网站xd seo无为县城乡建设局网站首页
  • 广州远洋建设实业公司网站红色大气网站