Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.

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.
Introduction to Processes
6/9/2015B.Ramamurthy1 Process Description and Control B.Ramamurthy.
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.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
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?
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
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.
CT213 - Computing systems Organization
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
1 Lecture 3: Processes Operating System Fall 2006.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
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.
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.
1 Process Description and Control Chapter 3. 2 Requirements of an Operating System Interleave the execution of multiple processes to maximize processor.
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.
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
Lecture 3 Process.
Process Management Process Concept Why only the global variables?
Process Description and Control
Structure of Processes
Process & its States Lecture 5.
Process Description and Control
Process Description and Control
Process Description and Control
Operating System 3 PROCESS DESCRIPTION AND CONTROL
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Process Description and Control
Process Description and Control
Process Description and Control
Process Description and Control
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Process Description and Control
Process Description and Control
Presentation transcript:

Process Description and Control Chapter 3

Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization while providing reasonable response time Allocate resources to processes Support interprocess communication (IPC) Creation and termination of processes

Process Also called a task Execution of an individual program Can be traced list the sequence of instructions that execute

Trace from processor’s point of view Timeout I/O Timeout

Context Switch CPU Process Descriptor X Process Descriptor Y

Invoking the Scheduler Voluntary call Process blocks itself (e.g. sleep(); wait())   scheduler is called Involuntary call External force (interrupt) blocks the process (e.g. timer interrupt or interrupt from an external I/O device or a signal sent by another process via kill())   scheduler is called

Two-State Process Model Process Creation User logs on Submission of a batch or a background job Created to provide a service such as printing (e.g. deamons) Process creates another process (e.g. fork())

Process Termination User logs off Batch job issues Halt instruction Quit an application Error and fault conditions External signals (e.g. kill()) Reasons for Process Termination Normal completion Time limit exceeded Memory unavailable Bounds violation Protection error (example write to a read-only file) Arithmetic error Time overrun (process waited longer than a specified max. for an event) I/O failure Privileged instruction / Invalid instruction (e.g.when try to execute data) Data misuse Operating system intervention such as when deadlock occurs Parent terminates so child processes terminate Parent request

A Five-State Model

Suspended Processes Processor is faster than I/O - some 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 Two new states Blocked, suspend Ready, suspend

Operating System Control Structures Information about the status of each process and resource Tables are constructed for each entity that the OS manages These tables are linked or cross-referenced in some fashion

Memory Tables Allocation of main memory (RAM) to processes Allocation of secondary memory to processes Protection attributes for access to shared memory regions Information needed to manage virtual memory File Tables List of files Location on secondary memory Current Status Attributes Mostly, this information is maintained and used by a file-management system

While the program is executing, this process can be uniquely characterized by a number of elements, including: identifier statepriority program counter memory pointers context data I/O status information accounting information

Process Table Collection of process descriptors for each task/process Each entry contains process identification (also part of PCB) Process ID, parent’s ID, children ID, and owner’s id pointers to the Process Control Block (PCB) and process image for each process PCB  Collection of attributes for managing the process Process image Collection of program, data (modifiable part), stack, and data stored in PCB A process may be linked to other processes which are related (e.g. children, parent)

Process Control Block (PCB) Identifiers PID, PPID, UserID Process State Information User-Visible Registers Typically, 16 to 32 registers that can be referenced by user programs directly Control and Status Registers Program counter: contains the address of the next instruction Condition codes: Result of the most recent arithmetic or logical operation (e.g., sign, zero, carry, equal, overflow) Status information: interrupt enabled/disabled flags, execution mode etc. Stack Pointers each process has one or more LIFO system stacks which is used to store parameters and calling addresses for procedure and system calls.

Process Control Information Scheduling and State Information needed by the OS to perform its scheduling function: Process state: (e.g., running, ready, waiting/blocked, halted). Priority: scheduling priority of the process. Scheduling-related information: that the scheduling algorithm may need (e.g. the amount of time spent in waiting, the amount of time used during the last time it was running, etc.) Event: Id of event the process is awaiting before it can run again Data Structuring A process may be linked to other processes in a queue, ring, or some other structure. For example, all processes in a waiting state for a particular priority level may be linked in a queue. A process may exhibit a parent-child (creator-created) relationship with another process. The PCB may contain pointers to other processes to support these structures. Process Control Block (PCB)

Process Control Information (cont.) Interprocess Communication info Various flags, signals, and messages associated with communication between processes. Process Privileges Processes are granted privileges in terms of the memory that may be accessed, the types of instructions that may be executed, the system utilities and services that may be used, etc. Memory Management includes pointers to segment and/or page tables that describe the virtual memory assigned to this process. Resource Ownership and Utilization Resources controlled by the process such as opened files. A history of utilization of the processor or other resources may also be included (may be needed by the scheduler) Process Control Block (PCB)

Process Creation Assign a unique process identifier (PID) Allocate space for the process Initialize process control block Set up appropriate linkages Ex: add new process to linked list (i.e. queue) used for scheduling When to Switch a Process Clock interrupt process has executed for the max. allowable time slice I/O interrupt Memory (page) fault The address referenced is not in main memory so it must be brought into main memory Trap When an error occurred may cause process to be moved to Exit state A system call which runs an OS routine ( e.g. fopen())

Execution of the Operating System

Execution Within User Processes

If no interrupts are pending the processor: proceeds to the fetch stage and fetches the next instruction of the current program in the current process If an interrupt is pending the processor: sets the program counter to the starting address of an interrupt handler program switches from user mode to kernel mode so that the interrupt processing code may include privileged instructions

The steps in a full process switch are: save the context of the processor update the process control block of the process currently in the Running state move the process control block of this process to the appropriate queue select another process for execution update the process control block of the process selected update memory management data structures restore the context of the processor to that which existed at the time the selected process was last switched out If the currently running process is to be moved to another state (Ready, Blocked, etc.), then the OS must make substantial changes in its environment

Change of Process State Save context of processor including program counter and other registers Update the PCB of the process that stopped running Move PCB to an appropriate queue - ready, blocked, etc. Select another process for execution Update the PCB of the process selected (e.g. change state to running) Restore context of the selected process CPU Process Descriptor X Process Descriptor Y

UNIX Process States User mode - Less-privileged, user programs typically execute in this mode System mode / control mode / kernel mode / supervisor mode More-privileged, e.g. kernel executes in this mode

Same state