重庆大学操作系统PPT3
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
–
•
Process Control Information
–
– – – – –
The Role of the Process Control Block
• Each process control block contains all of the information about a process that is needed by the OS. • One can say that the set of process control blocks defines the state of the OS.
Process Control Block
• Identifier: A unique identifier • State: Process state, such as running • Priority • Program counter: The address of the next instruction • Memory pointers: pointers to the program code and data • Context data: data in registers • I/O status information: I/O requests, I/O devices, file list, and so on. • Accounting information
Chapter 3 Process Description and Control
The way of program execution
• Serial execution
– Multiple programs to be executed sequentially, one by one
• Parallel execution
Process States
Process Trace
• The instruction sequence of process to be executed---- Process Trace • We can characterize behavior of the processor by showing how the traces of the various processes are interleaved.
•
Processor State Information
– – User-Visible Registers Control and Status Registers • Program counter • Condition codes • Status information Stack Pointers
Scheduling and State Information • Process state • Priority • Scheduling-related information • Event Data Structuring Interprocess Communication Process Privileges Memory Management Resource Ownership and Utilization
What is Process
• Process as an entity that consists of a number of elements. • Two essential elements
– program code (which may be shared with other processes that are executing the same program) – set of data associated with that code.
• a process has been swapped out of main memory------suspended
Suspended Processes
Suspended Processes
Suspended Processes
• Two new states
– Blocked-Suspend – Ready-Suspend
•
•
A Five-State Model
Parent request / termination
Parent request / termination
A Five-State Model
A Five-State Model
A Five-State Model
A Five-State Model
Suspendedຫໍສະໝຸດ BaiduProcesses
• Processor is faster than I/O, so all processes could be waiting for I/O • Some of processes are swapped out of main memory to free up more memory
Operating System Control Structures
• Memory Tables
– Allocation of main memory to processes – Allocation of secondary memory to processes – Protection attributes for access to shared memory regions – Information needed to manage virtual memory
Process Creation
When one process spawns another, the former is referred to as the parent process, and the spawned process is referred to as the child process.
Process Trace
Process Trace
Process Trace
Two-State Process Model
• Process may be in one of two states
– Running – Not-running
Two-State Process Model
Process Termination
A Five-State Model
A Five-State Model
• New: A process that has just been created but
• •
has not yet been admitted to the pool of executable processes by the OS. Ready: A process that is prepared to execute when given the opportunity. Running: The process that is currently being executed. Blocked: A process that cannot execute until some event occurs. Exit: A process that has been released from the pool of executable processes by the OS.
A Five-State Model
• Priority Queue
– If the dispatching of processes is dictated by a priority scheme, then it would be convenient to have a number of Ready queues, one for each priority level. The OS could then readily determine which is the highest-priority ready process that has been waiting the longest.
Operating System Control Structures
• File Tables
– Existence of files – Location on secondary memory – Current Status – Attributes
• Process Tables
– Manage processes – Process image
– Multiple programs to be executed at the same time
• Concurrent execution
Process
What is Process
• 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 the execution of a sequence of instructions, a current state, and an associated set of system resources
Process Control Structures
• Process image is the collection of program, Data, stack, and attributes (process control block)
The Role of the Process Control Block
• Information about the current status of each process and resource • Tables are constructed for each entity the operating system manages
Operating System Control Structures
User Processes in Virtual Memory (structure of process images)
Elements of a Process Control Block
• Process Identification
– Identifiers • Identifier of this process • Identifier of the process that created this process (parent process) • User identifier
Suspended Processes
Process Description
Process Description
• What information does the OS need to control processes and manage resources for them?
Operating System Control Structures
• I/O Tables
– I/O device is available or assigned – Status of I/O operation – Location in main memory being used as the source or destination of the I/O transfer
PROCESS CONTROL
Modes of Execution
• User mode
– Less-privileged mode – User programs typically execute in this mode