1 Process Description and Control Chapter 3. 2 Requirements of an Operating System Interleave the execution of multiple processes to maximize processor.

Slides:



Advertisements
Similar presentations
Process Description and Control
Advertisements

Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 3 Process Description and Control
Informationsteknologi Tuesday, September 18, 2007 Computer Systems/Operating Systems - Class 61 Today’s class Finish review of C Process description and.
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Day 11 Processes. Operating Systems Control Tables.
6/9/2015B.Ramamurthy1 Process Description and Control B.Ramamurthy.
Chapter 3 Process Description and Control
Process Description and Control
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Page 1 Processes and Threads Chapter 2. Page 2 Processes The Process Model Multiprogramming of four programs Conceptual model of 4 independent, sequential.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Chapter 3 Process Description and Control
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
CSCE 351: Operating System Kernels
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Processes and Resources
CSSE Operating Systems
1 Lecture 4: Processes Operating System Spring 2007 Chapter 4 of textbook.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
Process Description and Control
Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Process Description and Control
Operating System 3 PROCESS DESCRIPTION AND CONTROL.
CSNB224 – AAG 2007 Process Description and Control Chapter 3.
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 3 Process Description and Control
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Chapter 3 Advanced Operating System
Operating System 3 PROCESS DESCRIPTION AND CONTROL.
Chapter 3 Process Description and Control
Requirements of an Operating System Fundamental Task: Process Management The Operating System must – Interleave the execution of multiple processes – Allocate.
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z.
Processes Processes Dr. Sunny Jeong & Mr. M.H Park Operating Systems: Internals and Design Principles William Stallings.
Chapter 3 Process Description and Control Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic, N.Z.
Process Management CT213 - Computing systems Organization.
Politecnico di Milano © 2001 William Fornaciari Operating System Processes Lecturer: William Fornaciari Politecnico di Milano
Process Description and Control
1 Process Description and Control Chapter 2. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Process Description and control G.Anuradha (Referred from william stallings and galvin 8 th edition)
CSNB224 – AAG 2007 Process Description and Control Chapter 3.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Linux Development Lecture
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Process Description and Control
Day 08 Processes.
Day 09 Processes.
Overview of today’s lecture
Intro to Processes CSSE 332 Operating Systems
Process & its States Lecture 5.
Process Description and Control
Process Description and Control
Process Description and Control
Process Description and Control
Chapter 3 Process Description and Control
Operating System 3 PROCESS DESCRIPTION AND CONTROL
Process Description and Control
Process Description and Control
Process Description and Control
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Process Description and Control
Chapter 3 Process Description and Control
Presentation transcript:

1 Process Description and Control Chapter 3

2 Requirements of an Operating System Interleave the execution of multiple processes to maximize processor utilization while providing reasonable response time Allocate resources to processes Support interprocess communication and user creation of processes

3 What is a 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

4 Process Elements A process is an entity that consists of a number of elements. Two essential elements are program code( 程序代码 ) and a set of data( 与代码相关的数 据集 ). When the program is executing, it need include the following elements: Identifier (标识符) State (进程状态) Priority (优先级) Program counter (程序计数器) Memory pointers (内存指针) Context data (上下文数据) I/O status information ( I/O 状态信息) Accounting information (统计信息)

5 Process Control Block ( PCB , 进程控制块) Contains the process elements Created and manage by the operating system Allows OS to support for multiple processes

6 Process Control Block So, a process consists of program code and associated data plus a PCB

7 Trace of Process Sequence of instruction that execute for a process Dispatcher switches the processor from one process to another

8 Example Execution

9 Trace of Processes

10

11 Two-State Process Model Process may be in one of two states Running Not-running

12 Not-Running Process in a Queue When the operating system creates a new process, it enters the process into the system in the Not-running state.

13 Process Creation The operating system builds the data structures that are used to manage the process and allocates address space in main memory to the process.

14 Process Creation

15 Process Termination

16

17 Processes 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

18 A Five-State Model Running (运行) Ready (就绪) Blocked (阻塞) New (新建) : PCB has been created, but not loaded into main memory Exit (退出)

19 Five-State Process Model

20 Process States

21 Using Two Queues

22 Multiple Blocked Queues

23 Suspended( 挂起 ) Processes Processor is faster than I/O so all processes could be waiting for I/O Swap these processes to disk to free up more memory Blocked state becomes suspend state when swapped to disk

24 One Suspend State

25 Two Suspend States Blocked/Suspend (阻塞 / 挂起) Ready/Suspend (就绪 / 挂起)

26 Reasons for Process Suspension

27 Processes and Resources What information does the OS need to control processes and manage resources for them?

28 Operating System Control Structures Information about the current status of each process and resource Tables are constructed for each entity the operating system manages Four different types of tables: memory, I/O, file, process

29

30 Memory Tables( 存储表 ) keep track of both main and secondary memory. 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

31 I/O Tables(I/O 表 ) Manage the I/O devices and channels of the computer system. 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

32 File Tables( 文件表 ) Existence of files Location on secondary memory Current Status Attributes Sometimes this information is maintained by a file management system

33 Process Table( 进程表 ) Where process is located? What its attributes are managed? Process include: Program Data Stack Attributes in the process control block

34 Process Image( 进程映象 )

35 Process Control Block ( PCB , 进程控制块) Contains the process elements Created and manage by the operating system Allows support for multiple processes

36 Process Control Block Three general categories: Process identification( 进程标识 ) Processor State Information( 进程状 态信息 ) Process Control Information( 进程 控制信息 )

37 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

38 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 while in user mode. Control and Status Registers These are a variety of processor registers that are employed to control the operation of the processor. Stack Pointers

39 Process Control Information Scheduling and State Information Process state( 进程状态 ) Priority( 优先级 ) Scheduling-related information( 相关调 度信息 ) Event( 进程等待的事件 ) Data Structuring Interprocess Communication

40 Process Control Information Process Privileges (进程特权) Allow to access memory and to execute some instructions Memory Management This section may include pointers to segment and/or page tables that describe the virtual memory assigned to this process. Resource Ownership and Utilization

41 Process Control Block

42 Process Control Modes of Execution User mode Less-privileged mode User programs typically execute in this mode System mode, control mode, or kernel mode More-privileged mode Kernel of the operating system

43 Process Creation Assign a unique process identifier Allocate space for the process Initialize process control block Set up appropriate linkages Ex: add new process to linked list used for scheduling queue Create of expand other data structures Ex: maintain an accounting file

44 When to Switch a Process Clock interrupt process has executed for the maximum allowable time slice I/O interrupt Memory fault memory address is in virtual memory so it must be brought into main memory

45 When to Switch a Process Trap error or exception occurred may cause process to be moved to Exit state Supervisor call such as file open

46 Steps of Process Switch Save context of processor including program counter and other registers Update the process control block of the process that is currently in the Running state Move process control block to appropriate queue – ready; blocked; ready/suspend Select another process for execution

47 Update the process control block of the process selected: Running Update memory-management data structures Restore context of the selected process: load in the previous values of the PC and other register Steps of Process Switch

48 Execution of the Operating System Is the operating system a process? Non-process Kernel Execute kernel outside of any process Operating system code is executed as a separate entity that operates in privileged mode Execution Within User Processes Operating system software within context of a user process Process executes in privileged mode when executing operating system code

49 Process-Based Operating System Implement operating system as a collection of system processes Useful in multi-processor or multi- computer environment Execution of the Operating System

50