操作系统LEC3-进程管理

上传人:w****i 文档编号:92748243 上传时间:2019-07-12 格式:PPTX 页数:88 大小:3.07MB
返回 下载 相关 举报
操作系统LEC3-进程管理_第1页
第1页 / 共88页
操作系统LEC3-进程管理_第2页
第2页 / 共88页
操作系统LEC3-进程管理_第3页
第3页 / 共88页
操作系统LEC3-进程管理_第4页
第4页 / 共88页
操作系统LEC3-进程管理_第5页
第5页 / 共88页
点击查看更多>>
资源描述

《操作系统LEC3-进程管理》由会员分享,可在线阅读,更多相关《操作系统LEC3-进程管理(88页珍藏版)》请在金锄头文库上搜索。

1、Operating System,Lecture Three Process Description&Control School of Software Nanjing University,本主题教学目标,掌握进程的概念,可再入过程 掌握进程的状态、进程的挂起,以及队列实现模型 掌握操作系统的控制结构 掌握进程描述与控制的数据结构 掌握处理机模式的概念 掌握进程创建、模式切换、进程切换、进程队列、进程原语等进程实现的原理 了解操作系统的执行模型 了解SVR4的进程管理,Process Description and Control,Process States Process Two-St

2、ate Process Model Three-State Process Model Five-State Process Model Process Suspend Process Description Process Control Examples: Process,Major Requirements of an OS,Interleave the execution of several processes to maximize processor utilization while providing reasonable response time Allocate res

3、ources to processes Support interprocess communication(IPC) and user creation of processes,Process,Also called a task Execution of an individual program Can be traced list the sequence of instructions that execute,Process Definition,进程是一个具有一定独立功能的程序关于某个数据集合的一次运行活动 A process is a program in execution

4、, including: Process id and Data structure for process management and execution Code: program in memory Data: data in memory and its values Register values Program status word,Process Definition,Processi: (Pi, Ci, Di, Ri, Pswi) Program(data) Program(data) in memory (P1, C1, D1, R1, Psw1) and (P2, C2

5、, D2, R2, Psw2) C1 and C2(different program) , but D1 and D2(different data) C1 and C2(different program) , but D1 and D2(same data) C1 and C2(same program), but D1 and D2(different data) C1 and C2(same program), but D1 and D2(same data) (P1, C1, D1, R1, Psw1) and (P2, C2, D1, R2, Psw2) Concurrent p

6、rogramming(in fact, only share some data) (P1, C1, D1, R1, Psw1) and (P2, C1, D2, R2, Psw2) Share code(Reentrant program, Reentrant Procedure),Process Description and Control,Process States Process Two-State Process Model Three-State Process Model Five-State Process Model Process Suspend Process Des

7、cription Process Control Examples: Process,Two-State Process Model,Process may be in one of two states Running Not-running,Not-Running Process in a Queue,Process Creation,Submission of a batch job User logs on Created to provide a service such as printing Process creates another process,Process Term

8、ination,Batch job issues Halt instruction User logs off Quit an application Error and fault conditions,Reasons for Process Termination,Normal completion Time limit exceeded Memory unavailable Bounds violation Protection error example write to read-only file Arithmetic error Time overrun process wait

9、ed longer than a specified maximum for an event,Reasons for Process Termination,I/O failure Invalid instruction happens when try to execute data Privileged instruction Data misuse Operating system intervention such as when deadlock occurs Parent terminates so child processes terminate Parent request

10、,Process Description and Control,Process States Process Two-State Process Model Three-State Process Model Five-State Process Model Process Suspend Process Description Process Control Examples: Process,Three-State Process Model,Not-running(Ready ) ready to execute Blocked(Waiting ) waiting for I/O Di

11、spatcher cannot select the blocked process,Process State: Three States,Running, Ready, and Blocked(Wait),Process State: Three States,运行态等待态:等待使用资源;等待外设传输;等待人工干预/信号 等待态就绪态:资源得到满足;外设传输结束;人工干预/信号完成 运行态就绪态:运行时间到;出现有更高优先权进程 就绪态运行态:CPU空闲时选择一个就绪进程,Process Description and Control,Process States Process Two-

12、State Process Model Three-State Process Model Five-State Process Model Process Suspend Process Description Process Control Examples: Process,Five-State Process Model,Running Ready Blocked New Exit,Five-State Process Model,Process State: Five States,NULL新建态:执行一个程序/创建一个子进程 新建态就绪态:当OS完成了进程创建的必要操作,且当前系统

13、的性能和虚拟内存的容量均允许 运行态终止态:当一个进程到达了自然结束点,或出现了无法克服的错误,或被操作系统所终结,或被其他有终止权的进程所终结 终止态NULL:完成善后操作 就绪态终止态:未在状态转换图中显示,但某些操作系统允许父进程终结子进程 等待态终止态:未在状态转换图中显示,但某些操作系统允许父进程终结子进程,Using Two Queues,Process Description and Control,Process States Process Two-State Process Model Three-State Process Model Five-State Process

14、 Model Process Suspend Process Description Process Control Examples: Process,Suspended Processes,Processor is faster than I/O so all processes could be waiting for I/O Swap these processes to disk to free up more memory Blocked state becomes suspend state when swapped to disk Two new states Blocked,

15、 suspend Ready, suspend,Process State: Suspended,由于进程的不断创建,系统的资源已经不能满足进程运行的要求,这个时候就必须把某些进程挂起(suspend),对换到磁盘镜像区中,暂时不参与进程调度,起到平滑系统操作负荷的目的,One Suspend State,Two Suspend States,Process State: Suspended,一个挂起进程等同于不在主存的进程,它将不参与进程调度直到它们被对换进主存。它具有如下特征: 该进程不能立即被执行 挂起进程可能会等待一个事件,但所等待的事件是独立于挂起条件的,事件结束并不能导致进程具备执

16、行条件 进程进入挂起状态是由于操作系统、父进程或进程本身阻止它的运行 结束进程挂起状态的命令只能通过操作系统或父进程发出,Process State: Suspended,等待态挂起等待态:如果当前不存在就绪进程,那么至少有一个等待态进程将被对换出去成为挂起等待态;操作系统根据当前资源状况和性能要求,也可以决定把等待态进程将被对换出去成为挂起等待态 挂起等待态挂起就绪态:引起进程等待的事件发生之后,相应的挂起等待态进程将转换为挂起就绪态 就绪态挂起就绪态:操作系统根据当前资源状况和性能要求,也可以决定把就绪态进程将被对换出去成为挂起就绪态,Process State: Suspended,运行态挂起就绪态:当一个具有较高优先级的挂起等待态进程的等待事件结束后,它需要抢占了CPU,而此时主存空间有不够,从而可能导致正在运行的进程转化为挂起就绪态。另外处于运行态的进程也可以自己挂起自己 新建态挂起就绪态:考虑到系统当前资源状况和性能要求,可以决定新建的进程将被对换出去成为挂起就绪态,Process State: Suspended,挂起就绪态就绪态:当内

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号