高级进程管理

1.sched_yield()中断当前进程让出处理器
int sched_yield (void);
2.设置进程优先级
int nice (int inc);
int getpriority (int which, int who);
int setpriority (int which, int who, int prio);
3.设置I/O优先级
int ioprio_get (int which, int who)
int ioprio_set (int which, int who, int ioprio)
4.设置获取处理器亲和度
#define _GNU_SOURCE
#include <sched.h>
typedef struct cpu_set_t;
size_t CPU_SETSIZE;
void CPU_SET (unsigned long cpu, cpu_set_t *set);
void CPU_CLR (unsigned long cpu, cpu_set_t *set);
int CPU_ISSET (unsigned long cpu, cpu_set_t *set);
void CPU_ZERO (cpu_set_t *set);
int sched_setaffinity (pid_t pid, size_t setsize,const cpu_set_t *set);
int sched_getaffinity (pid_t pid, size_t setsize,const cpu_set_t *set);
5.设置调度策略
#include <sched.h>
struct sched_param {
    /* ... */
    int sched_priority;
    /* ... */
};
int sched_getscheduler (pid_t pid);
int sched_setscheduler (pid_t pid, int policy,const struct sched_param *sp);
6.设置调度策略参数
#include <sched.h>
struct sched_param {
    /* ... */
    int sched_priority;
    /* ... */
};
int sched_getparam (pid_t pid, struct sched_param *sp);
int sched_setparam (pid_t pid, const struct sched_param *sp);
7.确定有效优先级范围
int sched_get_priority_min (int policy);
int sched_get_priority_max (int policy);
8.获取时间片长度
#include <sched.h>
struct timespec {
    time_t tv_sec; /* seconds */
    long /* nanoseconds */
    tv_nsec;
};
int sched_rr_get_interval (pid_t pid, struct timespec *tp);








评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sjiang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值