当前位置:文档之家› 操作系统精髓与设计原理Chap3

操作系统精髓与设计原理Chap3


Process Control Block
– Control and Status Registers
These are a variety of processor registers that are employed to control the operation of the processor. These include • Program counter: Contains the address of the next instruction to be fetched • Condition codes: Result of the most recent arithmetic or logical operation (e.g., sign, zero, carry, equal, overflow) • Status information: Includes interrupt enabled/disabled flags, execution mode
1、 Two-State Process Model
• Process may be in one of two states
– Running – Not-running
Not-Running Process in a Queue
Round-robin: each process in the queue is given a certain amount of time,in turn, to execute and then returned to the queue.
Pentium II EFLAGS Register
Process Control Block
– Stack Pointers
• Each process has one or more last-in-first-out (LIFO) system stacks associated with it. A stack is used to store parameters and calling addresses for procedure and system calls. The stack pointer points to the top of the stack.
2、Process Image
• Process Image:
– – – – Program Data System/User Stack PCB
3、Process Control Block
• Contains the process elements • Created and manage by the operating system • Allows support for multiple processes Includes: • Process Indentification • Processor State Information • Process Control Information
Using Two Queues
3、Five-State Process Model
• • • • Running Ready Blocked New: data and program are not in memory,but PCB is created in memory. • Exit
• Process identification
– Identifiers
Numeric identifiers that may be stored with the process control block include • Identifier of this process • Identifier of the process that created this process (parent process) • User identifier
Outline
3.1 What is a process? 3.2 Process status 3.3 Process description 3.4 Process Control 3.5 Unix SVR4 Process Management
3.3 Process Description
1、Control structure of OS 、
Operating System Control Structures
• To manage the process and resources,OS must have the formation about the current status of each process and resource • Tables are constructed for each entity the operating system manages
Process Description and Control
Chapter 3
Outline
3.1 What is a process? 3.2 Process status 3.3 Process description 3.4 Process Control 3.5 Unix SVR4 Process Management
Process Control Block
• Processor State Information
– User-Visible Registers
• A user-visible register is one that may be referenced by means of the machine language that the processor executes. Typically, there are from 8 to 32 of these registers, although some RISC implementations have over 100.
进程概念和程序概念最大的不同之处
• 程序是静态的,无生命;进程是动态的,有生命周期。没有 程序是静态的,无生命;进程是动态的,有生命周期。 建立进程的程序不能作为一个独立单位得到操作系统的认可 。 • 程序可以脱离机器长期保存,即使不执行的程序也是存在的 程序可以脱离机器长期保存, 而进程是执行着的程序,当程序执行完毕, 。而进程是执行着的程序,当程序执行完毕,进程也就不存 在了。进程的生命是暂时的。 在了。进程的生命是暂时的。 • 程序不具有并发特征,不占用CPU、存储器及输入 输出设 程序不具有并发特征,不占用 、存储器及输入/输出设 备等系统资源,因此不会受到其他程序的制约和影响。 备等系统资源,因此不会受到其他程序的制约和影响。进程 具有并发性,在并发执行时,由于需要使用CPU、存储器、 具有并发性,在并发执行时,由于需要使用 、存储器、 输入/输出设备等系统资源 输出设备等系统资源, 输入 输出设备等系统资源,因此受到其他进程的制约和影 响。 • 一个程序可以对应多个进程,但一个进程只能对应一个程序 一个程序可以对应多个进程, 。进程和程序的关系犹如演出和剧本的关系
Outline
3.1 What is a process? 3.2 Process status 3.3 Process description 3.4 Process Control 3.5 Unix SVR4 Process Management
3.2 Process States
• • • • Two-State Process Model Three-State Process Model Five-Sate Process Model Seven-Sate Process Model
– Blocked, suspend – Ready, suspend
Reasons for Process Suspension
One Suspend State
Two Suspend States
Characteristics of suspended process
• Not immediately available for execution • May or may not be waiting on an event. If it is,blocked condition is independent of the suspend condition. • Be placed in a suspended state by an agent to prevent its execution. • Agent explicitly order to remove from suspended state.
3.1 Process
• Also called a task,or activity • A program in execution • An instance of a program running on a computer • The entity that can be assigned to and executed on a processor • A unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources
2、Three-State Process Model
• Not-running
– ready to execute – Blocked: waiting for I/O
ห้องสมุดไป่ตู้
• Dispatcher cannot just select the process that has been in the queue the longest because it may be blocked
相关主题