西安电子科技大学:《操作系统 Operating Systems》课程教学资源(PPT课件讲稿)Chapter 02 进程和线程 Processes and Threads

Operating Systems Processes and threads 21 Processes(进程) 22 Threads(线程) 23 Scheduling(调度) 24 Interprocess communication(进程间通信) 2. Classical IPc problems(经典IPC问题) Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 3 2.1 Processes (进程) 2.2 Threads(线程) 2.3 Scheduling(调度) 2.4 Interprocess communication(进程间通信) 2.5 Classical IPC problems (经典IPC问题) Processes and Threads

Operating Systems Processes: The Process model c Process: an executing program, including the current values of the program counter, register, and variables One program counter Process Four program counters A B C B D DcBA D Time g Multiprogramming of 4 programs Conceptual model of 4 independent, sequential processes g Only one program active at any instant Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 4 Processes: The Process Model Multiprogramming of 4 programs Conceptual model of 4 independent, sequential processes Only one program active at any instant Process: an executing program, including the current values of the program counter, register, and variables

Operating Systems Process Concept c An operating system executes a variety of programs H Batch system- jobs H Time-shared systems-user programs or tasks g Textbook uses the terms job and process almost interchangeably. G Process execution must progress in sequential fashion A process includes: a program counter程序计数器 stack栈 u data section数据部分 Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 5 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 execution must progress in sequential fashion. A process includes: program counter 程序计数器 stack 栈 data section 数据部分

Operating Systems P rocess creation Principal events that cause process creation System initialization(系统初始化) 2. Execution of a process creation system(系统调用) 3. User request to create a new process(用户命令) 4. Initiation of a batch job(批处理作业的初始化) Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 6 Process Creation Principal events that cause process creation: 1. System initialization (系统初始化) 2. Execution of a process creation system (系统调用) 3. User request to create a new process(用户命令) 4. Initiation of a batch job(批处理作业的初始化)

Operating Systems Process Creation(2) Parent process creates children processes, which, in turn create other processes, forming a tree of processes. g Resource sharing t Parent and children share all resources A Children share subset of parents resources t Parent and child share no resources g Execution执行 a Parent and children execute concurrently Parent waits until children terminate Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 7 Process Creation (2) Parent process creates children processes, which, in turn create other processes, forming a tree of processes. Resource sharing Parent and children share all resources. Children share subset of parent’s resources. Parent and child share no resources. Execution 执行 Parent and children execute concurrently. Parent waits until children terminate

Operating Systems Process Creation(3) e Address space Child duplicate of parent.子女复制双亲 Child has a program loaded into it.子女有一个程序被调入 g UNIX examples H fork system call creates new process H execve system call used after a fork to replace the process'memory space with a new program 在fork用一个新程序替代了进程的内存空间之后,采用 execve系统 调用 Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 8 Process Creation (3) Address space Child duplicate of parent. 子女复制双亲 Child has a program loaded into it. 子女有一个程序被调入 UNIX examples fork system call creates new process execve system call used after a fork to replace the process’ memory space with a new program. 在fork 用一个新程序替代了进程的内存空间之后,采用execve系统 调用

Operating Systems Process Termination Conditions which terminate processes Normal exit(voluntary) 2. Error exit( voluntary)(错误退出) 3. Fatal error( involuntary)(严重错误) 4. Killed by another process(involuntary) Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 9 Process Termination Conditions which terminate processes: 1. Normal exit (voluntary) 2. Error exit (voluntary) (错误退出) 3. Fatal error (involuntary) (严重错误) 4. Killed by another process (involuntary)

Operating Systems Process Termination(2) g Process executes last statement and asks the operating system to decide it(exit). H Process'resources are deallocated(再分配) by operating system e Parent may terminate execution of children processes (abort). a Child has exceeded allocated resources.超量分配资源 Task assigned to child is no longer required H Parent is exiting. Operating system does not allow child to continue if its parent terminates Cascading termination.级联终止 Gao Haichang, Software School, Xidian University 10
Operating Systems Gao Haichang , Software School, Xidian University 10 Process Termination (2) Process executes last statement and asks the operating system to decide it (exit). Process’ resources are deallocated (再分配) by operating system. Parent may terminate execution of children processes (abort). Child has exceeded allocated resources. 超量分配资源 Task assigned to child is no longer required. Parent is exiting. ➢ Operating system does not allow child to continue if its parent terminates. ➢ Cascading termination. 级联终止

Operating Systems Process Hierarchies c Parent creates a child process, child processes can create its own process, forms a hierarchy(层次关系) H UNIX calls this a " process group Windows has no concept of process hierarchy H all processes are created equal Gao Haichang, Software School, Xidian University
Operating Systems Gao Haichang , Software School, Xidian University 11 Process Hierarchies Parent creates a child process, child processes can create its own process, forms a hierarchy (层次关系) UNIX calls this a “process group” Windows has no concept of process hierarchy all processes are created equal

Operating Systems A Tree of Processes On A Typical UNIX System root pagedaemon swapper user 1 user 2 user Gao Haichang, Software School, Xidian University 12
Operating Systems Gao Haichang , Software School, Xidian University 12 A Tree of Processes On A Typical UNIX System
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《数字图像处理 Digital Image Processing》课程教学资源(PPT课件讲稿)第2章 图像的基本知识及运算.ppt
- 江苏海洋大学(淮海工学院):《Java面向对象程序设计》课程教学资源(PPT课件讲稿)第3章 Java 面向对象编程 3.1 面向对象软件开发概述.pptx
- 利用NetRiver实验系统实现IP协议交互和TCP协议交互.ppt
- 《软件工程简介》课程PPT教学课件(可行性研究、需求分析、总体设计、详细设计).ppt
- ARM Tachnology:Chapter 3 STM32 Clock and Configuration.ppt
- 《汇编语言程序设计》课程教学资源(PPT课件讲稿)循环与分支程序设计.ppt
- 香港科技大学:Latent Tree Models.pptx
- Network and System Security Risk Assessment(PPT讲稿)Introduction.ppt
- 复旦大学:Trapping in scale-free networks with hierarchical organization of modularity.pptx
- 电子工业出版社:《计算机网络》课程教学资源(第五版,PPT课件讲稿)第十章 下一代因特网.ppt
- 卷积码的概率译码(PPT讲稿).ppt
- 《ASP动态网页设计实用教程》教学资源(PPT课件讲稿)第8章 Web数据库基础.ppt
- Lower bound for sorting, radix sort.ppt
- 数据传送类指令(PPT讲稿).ppt
- 长春工业大学:《电子商务》课程教学资源(PPT课件)第9章 网络鞋城前台页面.ppt
- 因特网多媒体技术(PPT讲稿).ppt
- International Trade Forms.ppt
- 香港理工大学:Building Robust Wireless LAN for Industrial Control with DSSS-CDMA Cell Phone Network Paradigm.ppt
- 香港浸会大学:《Experiencing Cluster Computing》Class 8 Case Studies.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)动态调度(Cont)、推断执行和ILP.ppt
- 《计算机辅助设计 Computer Aided Design》课程PPT教学课件:第一篇 CAD技术 第一章 几何造型方法介绍和分类.ppt
- 清华大学:高校信息门户建设(PPT讲稿).ppt
- 《汇编语言》课程PPT教学课件:第三章 80x86寻址方式和指令系统.ppt
- 《网站设计与建设 Website design and developments》课程教学资源(PPT课件讲稿)第一部分 Web基础知识 第3章 图形与Web设计.ppt
- 香港城市大学:Introduction to Real-Time Systems(Design and Analysis of Algorithms).pptx
- 《编译原理》课程教学资源(PPT课件讲稿)第五章 语法分析——自下而上分析.ppt
- 香港科技大学:Advanced Topics in NextGeneration Wireless Networks.ppt
- 复旦大学:《数据库基础与应用》课程PPT教学课件(Access案例教程)第1章 数据库基础知识.pptx
- Transport Layer Identification of P2P Traffic.ppt
- 上海交通大学:Basic Raster Graphics Algorithms for Drawing 2D Primitives.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第七章 中间代码生成.ppt
- 《MATLAB应用基础》课程教学资源(PPT课件讲稿)第4章 MATLAB的数值计算.ppt
- 安徽广播影视职业技术学院:《ASP动态网页设计实用教程》课程教学资源(PPT讲稿)第1章 ASP基础(贾海陶).ppt
- 白城师范学院:《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第六章 关系数据理论.pptx
- 中国科学技术大学:《数据结构及其算法》课程电子教案(PPT课件讲稿)第三章 栈和队列.pps
- 北京大学SAS俱乐部:SAS软件会员培训(PPT讲稿)SAS编程语言入门.ppt
- 泛型编程 Generic Programming(PPT讲稿)Templates.ppt
- 西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 9 Service and Broadcast Receiver.pptx
- 计算机问题求解(PPT讲稿)算法在计算机科学中的地位(算法的效率).pptx
- 《计算机组装与维修》课程教学资源(PPT讲稿)第7章 显示器.ppt