Module 4: processes 进程 ° Process Concept 进程概念 ● Process Scheduling 进程调度 Operation on Processes 进程上的操作 e Cooperating processes 协同进程 e Interprocess Communication 进程间通信 Applied Operating System Concepts
4.1 Applied Operating System Concepts Module 4: Processes 进程 • Process Concept 进程概念 • Process Scheduling 进程调度 • Operation on Processes 进程上的操作 • Cooperating Processes 协同进程 • Interprocess Communication 进程间通信
Process Concept 进程概念 An operating system executes a variety of programs: 操作系统执行各种程序 Batch system-jobs批处理系统-作业 Time-shared systems -user programs or tasks 分时系统用户程序或任务 Textbook uses the terms job and process almost interchangeably.本书使用的名词作业和进程,基本可互换 Process-a program in execution; process execution must progress in sequential fashion. 进程-在执行中的程序;进程的执行必须以顺序方式进行 A process includes:个进程包括 program counter程序计数器 stack栈 data section数据部分 Applied Operating System Concepts
4.2 Applied Operating System Concepts Process Concept 进程概念 • An operating system executes a variety of programs: 操作系统执行各种程序 – Batch system – jobs 批处理系统 - 作业 – Time-shared systems – user programs or tasks 分时系统 - 用户程序或任务 • Textbook uses the terms job and process almost interchangeably. 本书使用的名词作业和进程,基本可互换 • Process – a program in execution; process execution must progress in sequential fashion. 进程 - 在执行中的程序;进程的执行必须以顺序方式进行 • A process includes: 一个进程包括 – program counter 程序计数器 – stack 栈 – data section 数据部分
Process state 进程状态 As a process executes, it changes state 进程执行时,改变状态 new: The process is being created. 新建:在创建进程 running: Instructions are being executed. 运行:指令在执行 waiting: The process is waiting for some event to occur 等待:进程等待某些事件发生 ready The process is waiting to be assigned to a processor. 就绪:进程等待分配处理器 terminated: The process has finished execution 终止:进程执行完毕 Applied Operating System Concepts
4.3 Applied Operating System Concepts Process State 进程状态 • As a process executes, it changes state 进程执行时,改变状态 – new: The process is being created. 新建:在创建进程 – running: Instructions are being executed. 运行:指令在执行 – waiting: The process is waiting for some event to occur. 等待:进程等待某些事件发生 – ready: The process is waiting to be assigned to a processor. 就绪:进程等待分配处理器 – terminated: The process has finished execution. 终止:进程执行完毕
Diagram of Process state 进程状态图 admitted interrupt exit terminated ready running scheduler dispatch vo or event completion vo or event wait alting Applied Operating System Concepts 4.4
4.4 Applied Operating System Concepts Diagram of Process State 进程状态图
Process Control Block(PCB) 进程控制块 Information associated with each process 同进程有关的信息 ● Process state =进程状态 ● Program counter 程序计数器 ° CPU registers CPU寄存器 CPU scheduling information CPU调度信息 Memory-management information内存管理信息 Accounting information 计账信息 e o status information O状态信息 Applied Operating System Concepts 4.5
4.5 Applied Operating System Concepts Process Control Block (PCB) 进程控制块 Information associated with each process. 同进程有关的信息 • Process state 进程状态 • Program counter 程序计数器 • CPU registers CPU寄存器 • CPU scheduling information CPU调度信息 • Memory-management information内存管理信息 • Accounting information 计账信息 • I/O status information I/O状态信息
Process Control Block(PCB) 进程控制块 pointer process state process number program counter registers memory limits list of open files Applied Operating System Concepts
4.6 Applied Operating System Concepts Process Control Block (PCB) 进程控制块
CPU Switch From Process to Process 进程间cPU的切换 process operating system process P interrupt or system call g save state into PCB e reload state from PCB, nterrupt or system call executing save state into PCB, reload state from PCBo executing Applied Operating System Concepts 4.7
4.7 Applied Operating System Concepts CPU Switch From Process to Process 进程间CPU的切换
Process Scheduling queues 进程调度队列 Job queue-set of all processes in the system 作业队列-在系统中的所有进程的集合 Ready queue- set of all processes residing in main memory, ready and waiting to execute. 就绪队列-在主内存中的,就绪并等待执行的所有进程的集合 Device queues- set of processes waiting for an l/o device. 设备队列等待某一O设备的进程队列 Process migration between the various queues 在各种队列之间进程的迁移 Applied Operating System Concepts 48
4.8 Applied Operating System Concepts Process Scheduling Queues 进程调度队列 • Job queue – set of all processes in the system. 作业队列 - 在系统中的所有进程的集合 • Ready queue – set of all processes residing in main memory, ready and waiting to execute. 就绪队列 - 在主内存中的,就绪并等待执行的所有进程的集合 • Device queues – set of processes waiting for an I/O device. 设备队列 - 等待某一I/O设备的进程队列 Process migration between the various queues. 在各种队列之间进程的迁移
Ready Queue And various lO Device Queues 就绪队列和各种ⅣO设备队列 queue header PCB PCB rea dy head queue tail registers registers mag head tape unit o tail mag head tail PCB PCB,4 PCB disk head unit o ta PCB terminal head unit 0 tal Applied Operating System Concepts
4.9 Applied Operating System Concepts Ready Queue And Various I/O Device Queues 就绪队列和各种I/O设备队列
Representation of Process Scheduling 进程调度的描述 ready queue CPU l/ 1o queue 1O request time slice expired child fork a executes child interrupt wait for an occurs interrupt Applied Operating System Concepts 4.1
4.10 Applied Operating System Concepts Representation of Process Scheduling 进程调度的描述