进程在内核中的组织

进程与程序

  • 程序是包含可执行代码以及执行代码需要的数据等信息的文件,存放在磁盘等介质上。
  • 当程序被操作系统装载到内存并分配给它一定资源后,此时可称为进程
  • 程序静态概念,进程动态概念

进程在内核中的组织形式:进程控制块(PCB)

Linux 进程控制块: task_struct 结构

pid_t pid;
uid_t uid,euid;
gid_t gid,egid;
volatile long state;
int exit_state;
unsigned int rt_priority;
unsigned int policy;
struct list_head tasks;
struct task_struct *real_parent;
struct task_struct *parent;
struct list_head children,sibling;
struct fs_struct *fs;
struct files_struct *files;
struct mm_struct *mm;
struct signal_struct *signal;
struct sighand_struct *sighand;
cputime_t utime, stime;
struct timespec start_time;
struct timespec real_start_time;
  • 进程状态:

    volatile long state;

  • state 成员的可能取值如下:
    1.  #define TASK_RUNNING 0
    2.  #define TASK_INTERRUPTIBLE 1
    3.  #define TASK_UNINTERRUPTIBLE 2
    4.  #define TASK_ZOMBIE 4
    5.  #define TASK_STOPPED 8

进程状态切换

 

转载于:https://www.cnblogs.com/51try-again/p/11066811.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值