当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

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

资源类别:文库,文档格式:PPT,文档页数:75,文件大小:2.53MB,团购合买
 2.1 Processes (进程)  2.2 Threads(线程)  2.3 Scheduling(调度)  2.4 Interprocess communication(进程间通信)  2.5 Classical IPC problems (经典IPC问题)
点击下载完整版文档(PPT)

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

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共75页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有