zoukankan      html  css  js  c++  java
  • 进程在内核中的组织

    进程与程序

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

    进程在内核中的组织形式:进程控制块(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

    进程状态切换

     

  • 相关阅读:
    MySQL 分组
    MySQL LIKE 子句
    MySQL DELETE 语句
    MySQL UPDATE 查询
    MySQL where 子句
    MySQL 插入数据
    MySQL 查询数据
    MySQL 删除数据表
    MySQL 创建数据表
    MySQL 数据类型
  • 原文地址:https://www.cnblogs.com/51try-again/p/11066811.html
Copyright © 2011-2022 走看看