进程学习杂项汇总

1. 进程状态描述,即 task_struct 的 state 成员取值

// include/linux/sched.h
/* Per process flags */
#define PF_IDLE            0x00000002    /* 我是一个空闲线程*/ /* I am an IDLE thread */
#define PF_EXITING        0x00000004    /* 关机 */ /* Getting shut down */
#define PF_EXITPIDONE    0x00000008    /* 关闭时PI退出完成 */ /* PI exit done on shut down */
#define PF_VCPU            0x00000010    /* 我是一个虚拟CPU */ /* I'm a virtual CPU */
#define PF_WQ_WORKER    0x00000020    /* 我是工作队列工作者 */ /* I'm a workqueue worker */
#define PF_FORKNOEXEC    0x00000040    /* Forked了但是还没有执行 */ /* Forked but didn't exec */
#define PF_MCE_PROCESS    0x00000080  /* 关于mce错误的处理策略 */ /* Process policy on mce errors */
#define PF_SUPERPRIV    0x00000100    /* 使用的超级用户特权 */ /* Used super-user privileges */
#define PF_DUMPCORE        0x00000200    /* 转储核心 */ /* Dumped core */
#define PF_SIGNALED        0x00000400    /* 被信号杀死 */ /* Killed by a signal */
#define PF_MEMALLOC        0x00000800    /* 分配内存 */ /* Allocating memory */
#define PF_NPROC_EXCEEDED    0x00001000    /* set_user()注意到已超过 RLIMIT_NPROC */ /* set_user() noticed that RLIMIT_NPROC was exceeded */
#define PF_USED_MATH        0x00002000    /* 如果未设置,则必须在使用前初始化fpu */ /* If unset the fpu must be initialized before use */
#define PF_USED_ASYNC        0x00004000    /* 使用async_schedule(),由模块初始化使用 */ /* Used async_schedule*(), used by module init */
#define PF_NOFREEZE            0x00008000    /* 此线程不应被冻结 */ /* This thread should not be frozen */
#define PF_FROZEN            0x00010000    /* 系统suspend冻结 */ /* Frozen for system suspend */
#define PF_KSWAPD            0x00020000    /* 我是kswapd */ /* I am kswapd */
#define PF_MEMALLOC_NOFS    0x00040000    /* 所有分配请求将继承 GFP_NOFS */ /* All allocation requests will inherit GFP_NOFS */
#define PF_MEMALLOC_NOIO    0x00080000    /* 所有分配请求将继承 GFP_NOIO */ /* All allocation requests will inherit GFP_NOIO */
#define PF_LESS_THROTTLE    0x00100000    /* 减少对我的限制:我清理内存 */ /* Throttle me less: I clean memory */
#define PF_KTHREAD            0x00200000    /* 我是内核线程 */ /* I am a kernel thread */
#define PF_RANDOMIZE        0x00400000    /* 随机化虚拟地址空间 */ /* Randomize virtual address space */
#define PF_SWAPWRITE        0x00800000    /* 允许写入交换 */ /* Allowed to write to swap */
#define PF_NO_SETAFFINITY    0x04000000    /* 不允许用户区与cpus_allowed */ /* Userland is not allowed to meddle with cpus_allowed */
#define PF_MCE_EARLY        0x08000000  /* 早期终止mce进程策略 */ /* Early kill for mce process policy */
#define PF_MUTEX_TESTER        0x20000000    /* 线程属于rt互斥测试器 */ /* Thread belongs to the rt mutex tester */
#define PF_FREEZER_SKIP        0x40000000    /* 冻结器不应将其视为可冻结 */ /*/ *冰箱不应将其视为可冻结* /*/
#define PF_SUSPEND_TASK        0x80000000  /* 这个是调用 freeze_processes()的线程,不应冻结 */ /* This thread called freeze_processes() and should not be frozen */
原文地址:https://www.cnblogs.com/hellokitty2/p/14221241.html