CREAT PROCESS


fork()
|
clone(參数,决定父子函数的共享内容)
|
do_fork()
|
copy_process()
|
dup_task_struct()
创建子进程的内核堆栈。复制父进程的进程描写叙述符(task_struct)
进程描写叙述符的非常多成员被清除或者设为初值
设置子进程的状态task_struct-->state
设置子进程的权限task_struct-->flags
设置子进程的进程号task_struct-->PID
依据clone的參数,拷贝或共享:
打开的文件(task_struct-->fd),
文件系统信息(task_struct),
信号处理函数(task_struct-->struct
signal_struct *signal;)
进程的地址空间(task_struct-->struct
mm_struct *mm, *active_mm;)
让父子进程平分剩余的时间片。
|
子进程被唤醒,调用exec()并运行!

NOTE

进程几点要注意的:
1,进程能够运行一个或者多个程序,一个程序能够被多个进程运行。

2,受到共享资源的约束,进程会产生约束关系,造成进程会处于不同的状态。比方等待没有一个资源如IO请求。或造成堵塞,直到资源被满足才会释放该进程,进入运行状态。

对于时间片用完的进程会进入就绪状态。


3,临界资源一次仅仅同意一个进程使用。
EXIT PROCESS

exit()

|

do_exit()
|
对task_struct的state(设为PF_EXITING)、mm(调用__exit__mm())、segment(调用sem_exit),file(__exit_files),fs(__exit_fs),signal(exit_sighand),exit_code,notify等资源进行释放。然后调用schedule()调用其它的进程。此时进程处于僵尸状态,进程描写叙述符存在于链表中,直到父进程调用wait4()。才全然释放进程。删除链表中的进程描写叙述符task_struct和共享的资源。

版权声明:本文博客原创文章,博客,未经同意,不得转载。

linux process management的更多相关文章

  1. Performance Tuning Using Linux Process Management Commands

    [root@bigdata-server-02 /]# ps --help all Usage: ps [options] Basic options: -A, -e all processes -a ...

  2. Linux Process Management && Process Scheduling Principle

    目录 . 引言 . 进程优先级 . 进程的生命周 . 进程表示 . 进程管理相关的系统调用 . 进程调度 . 完全公平调度类 . 实时调度类 . 调度器增强 . 小结 1. 引言 在多处理器系统中,可 ...

  3. Java Business Process Management(业务流程管理) 初识环境搭建

    一.简介 (一)什么是jbpm JBPM,全称是Java Business Process Management(业务流程管理),它是覆盖了业务流程管理.工作流.服务协作等领域的一个开源的.灵活的.易 ...

  4. Linux process vs thread

    Linux process vs thread Question I have a query related to the implementation of threads in Linux. L ...

  5. Linux Process VS Thread VS LWP

    Process program program==code+data; 一个进程可以对应多个程序,一个程序也可以变成多个进程.程序可以作为一种软件资源长期保存,以文件的形式存放在硬盘 process: ...

  6. Shell script for logging cpu and memory usage of a Linux process

    Shell script for logging cpu and memory usage of a Linux process http://www.unix.com/shell-programmi ...

  7. linux process cycle

    As already discussed, a new process is created through fork() and if a new executable is to be run t ...

  8. <<Linux kernel development>> Process Management

    The Process On modern operating systems,processes provide two virtualizations:a virtualized processo ...

  9. Linux Process Virtual Memory

    目录 . 简介 . 进程虚拟地址空间 . 内存映射的原理 . 数据结构 . 对区域的操作 . 地址空间 . 内存映射 . 反向映射 .堆的管理 . 缺页异常的处理 . 用户空间缺页异常的校正 . 内核 ...

随机推荐

  1. 一、Github博客搭建之jekyll安装

    注意:以下步骤是FQ后操作的,需要了解FQ的可以移步 -> 枫叶主机 一.安装jekyll需要Ruby-2.1.0以上版本,本人是mac pro系统版本10.12.5(macOS Sierra) ...

  2. vue学习笔记三:常见的表单绑定

    <template> <div id="app"> <input type="checkbox" id="checked ...

  3. vmware之linux不重启添加虚拟硬盘

    转自http://www.shangxueba.com/jingyan/1610981.html #echo "- - -" > /sys/class/scsi_host/h ...

  4. 【31.72%】【codeforces 604B】More Cowbell

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  5. iOS开发SDWebImage的基本使用

    #import "ViewController.h" #import "UIImageView+WebCache.h" #import "SDWebI ...

  6. Lucene学习总结之八:Lucene的查询语法,JavaCC及QueryParser 2014-06-25 14:25 722人阅读 评论(1) 收藏

    一.Lucene的查询语法 Lucene所支持的查询语法可见http://lucene.apache.org/java/3_0_1/queryparsersyntax.html (1) 语法关键字 + ...

  7. Android 圆角ListView

    方法一:定义 <?xml version ="1.0" encoding ="UTF-8" ?> <shape xmlns:android = ...

  8. PatentTips - Integrated circuit well bias circuitry

    1. Field of the Invention This invention relates in general to an integrated circuit and more specif ...

  9. 【codeforces 757C】Felicity is Coming!

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  10. java 线程排查问题流程

    1. 通过top命令查看当前系统CPU使用情况,定位CPU使用率超过100%的进程ID:2. 通过ps aux | grep PID命令进一步确定具体的线程信息:3. 通过ps -mp pid -o ...