• 多核亲和性


    1,进程绑定

    #include <sched.h> 
    cpu_set_t  set;
    void CPU_ZERO(cpu_set_t *set);
    void CPU_SET(int cpu, cpu_set_t *set);
    void CPU_CLR(int cpu, cpu_set_t *set);
    int CPU_ISSET(int cpu, cpu_set_t *set);

    int sched_setaffinity(pid_t pid, size_t cpusetsize,cpu_set_t *mask);   
    int sched_getaffinity(pid_t pid, size_t cpusetsize,cpu_set_t *mask);   

    2,线程绑定

    int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, const cpu_set_t *cpuset);
    int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize, cpu_set_t *cpuset);

    3,内核态

    void kthread_bind (struct task_struct *k, unsigned int  cpu);
    int set_cpus_allowed(struct task_struct *k, cpumask_t new_mask);

    4,命令行绑定

    taskset -p <COREMASK>  <PID>

    taskset -cp <CORE-LIST>  <PID> 

    5,中断绑核:

    echo 0x3 /proc/irq/24/smp_affinity

    cat /proc/irq/24/smp_affinity

  • 相关阅读:
    密码学浅析
    FireWall Mark + LVS
    tcp/ip首部
    iptables(二)网络防火墙
    BIND服务
    LVS(一)
    QQ、微信消息轰炸
    LVS四种模型(二)
    安装和克隆
    压缩和打包
  • 原文地址:https://www.cnblogs.com/soul-stone/p/6130720.html
Copyright © 2020-2023  润新知