IT 540 Operating Systems ECE519 Advanced Operating Systems

Similar documents
Chapter 3 Process Description and Control

Process Description and Control. Chapter 3

Operating Systems. Lecture 3- Process Description and Control. Masood Niazi Torshiz

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

Major Requirements of an OS

Announcement. Exercise #2 will be out today. Due date is next Monday

Process Description and Control

Process Description and Control. Chapter 3

Operating System Control Structures

Today s class. Finish review of C Process description and control. Informationsteknologi. Tuesday, September 18, 2007

Process Description and Control

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Process. Discussion session 3 1/30/2016

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Introduction to Processes in Computer Systems SEEM

Process Description and Control

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION. Ch-3 Process Description and Control

Process Description and Control. Chapter 3

Chapter 3 Process Description and Control

3.1 Introduction. Computers perform operations concurrently

PROCESS DESCRIPTION AND CONTROL

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

OPERATING SYSTEM. The Process. Introduction Process creation & termination Process state diagram Process scheduling & its criteria

Process Description and Control

Operating System. Chapter 3. Process. Lynn Choi School of Electrical Engineering

Wednesday, September 14, Chapter 3: Processes

Part V. Process Management. Sadeghi, Cubaleska RUB Course Operating System Security Memory Management and Protection

The fundamental task of any modern operating system is process management.

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Why use an Operating System? Operating System Definition

ECE519 Advanced Operating Systems

CSCE Introduction to Computer Systems Spring 2019

Roadmap. Tevfik Ko!ar. CSC Operating Systems Fall Lecture - III Processes. Louisiana State University. Processes. September 1 st, 2009

Chap 4, 5: Process. Dongkun Shin, SKKU

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors

Process Concepts. CSC400 - Operating Systems. 3. Process Concepts. J. Sumey

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

Processes, PCB, Context Switch

Course: Operating Systems Instructor: M Umair. M Umair

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

آنستیتیوت تکنالوجی معلوماتی و مخابراتی ICTI

OPERATING SYSTEM SUPPORT (Part 1)

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Processes and Non-Preemptive Scheduling. Otto J. Anshus

OS Main Goals. 10/24/2013 Operating Systems, Beykent University 1

Operating Systems Process description and control

! The Process Control Block (PCB) " is included in the context,

CSC 539: Operating Systems Structure and Design. Spring 2006

Computer Systems II. First Two Major Computer System Evolution Steps

1 PROCESSES PROCESS CONCEPT The Process Process State Process Control Block 5

Learning Outcomes. Processes and Threads. Major Requirements of an Operating System. Processes and Threads

Operating System Support

Threads Chapter 5 1 Chapter 5

SMD149 - Operating Systems

System Call. Preview. System Call. System Call. System Call 9/7/2018

IT 540 Operating Systems ECE519 Advanced Operating Systems

Introduction to Process in Computing Systems SEEM

Processes and Threads

Course Syllabus. Operating Systems, Spring 2016, Meni Adler, Danny Hendler & Amnon Meisels

2. The system of... generally ran one job at a time. These were called single stream batch processing.

Operating Systems Overview. Chapter 2

Process Management Rab Nawaz Jadoon

Processes and More. CSCI 315 Operating Systems Design Department of Computer Science

OPERATING SYSTEMS. P. PRAVEEN Asst.Prof, CSE

CS510 Operating System Foundations. Jonathan Walpole

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

Module 1. Introduction:

Process! Process Creation / Termination! Process Transitions in" the Two-State Process Model! A Two-State Process Model!

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100


UNIT 3. PROCESS MANAGEMENT

Chapter 8: Virtual Memory. Operating System Concepts Essentials 2 nd Edition

OPERATING SYSTEM : RBMCQ0402. Third RavishBegusarai.

Chapter 9: Virtual Memory. Operating System Concepts 9 th Edition

ELEC 377 Operating Systems. Week 1 Class 2

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year

CS370 Operating Systems

Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management

Chapter 9: Virtual Memory

Process Scheduling Queues

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Chapter 3: Processes. Operating System Concepts 8 th Edition,

Processes and Threads

Computer System Overview. Chapter 1

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

ECE519 Advanced Operating Systems

Solved MCQs on Operating System Principles. Set-1

Process Time. Steven M. Bellovin January 25,

OPERATING SYSTEMS: Lesson 4: Process Scheduling

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

Chapter 3 Processes. Process Concept. Process Concept. Process Concept (Cont.) Process Concept (Cont.) Process Concept (Cont.)

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Lecture 4: Process Management

OPERATING SYSTEMS. After A.S.Tanenbaum, Modern Operating Systems, 3rd edition. Uses content with permission from Assoc. Prof. Florin Fortis, PhD

CSC 4320 Test 1 Spring 2017

CSCE 313: Intro to Computer Systems

Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5

Transcription:

IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (3 rd Week)

(Advanced) Operating Systems 3. Process Description and Control

3. Outline What Is a Process? Process States Process Description Process Control Execution of the Operating System

A computer platform consists of a collection of hardware resources Computer applications are developed to perform some task It is inefficient for applications to be written directly for a given hardware platform The OS was developed to provide a convenient, feature-rich, secure, and consistent interface for applications to use We can think of the OS as providing a uniform, abstract representation of resources that can be requested and accessed by applications

OS Management of Application Execution Resources are made available to multiple applications The processor is switched among multiple applications so all will appear to be progressing The processor and I/O devices can be used efficiently

Process Elements Two essential elements of a process are: Program code which may be shared with other processes that are executing the same program A set of data associated with that code when the processor begins to execute the program code, we refer to this executing entity as a process

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

Identifier Process Control Block Contains the process elements It is possible to interrupt a running process and later resume execution as if the interruption had not occurred State Priority Program counter Memory pointers Context data I/O status information Accounting information Created and managed by the operating system Key tool that allows support for multiple processes Figure 3.1 Simplified Process Control Block

Process States Trace the behavior of an individual process by listing the sequence of instructions that execute for that process Dispatcher small program that switches the processor from one process to another the behavior of the processor can be characterized by showing how the traces of the various processes are interleaved

Two-State Process Model Dispatch Enter Not Running Running Exit Pause (a) State transition diagram

Process Execution Address 0 100 5000 Main Memory Dispatcher Process A Program Counter 8000 8000 Process B 12000 Process C Figure 3.2 Snapshot of Example Execution (Figure 3.4) at Instruction Cycle 13

5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 8000 8001 8002 8003 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 (a) Trace of Process A (b) Trace of Process B (c) Trace of Process C 5000 = Starting address of program of Process A 8000 = Starting address of program of Process B 12000 = Starting address of program of Process C Figure 3.3 Traces of Processes of Figure 3.2

1 5000 2 5001 3 5002 4 5003 5 5004 6 5005 -------------------- Timeout 7 100 8 101 9 102 10 103 11 104 12 105 13 8000 14 8001 15 8002 16 8003 ----------------I/O Request 17 100 18 101 19 102 20 103 21 104 22 105 23 12000 24 12001 25 12002 26 12003 27 12004 28 12005 -------------------- Timeout 29 100 30 101 31 102 32 103 33 104 34 105 35 5006 36 5007 37 5008 38 5009 39 5010 40 5011 -------------------- Timeout 41 100 42 101 43 102 44 103 45 104 46 105 47 12006 48 12007 49 12008 50 12009 51 12010 52 12011 -------------------- Timeout 100 = Starting address of dispatcher program Shaded areas indicate execution of dispatcher process; first and third columns count instruction cycles; second and fourth columns show address of instruction being executed Figure 3.4 Combined Trace of Processes of Figure 3.2

Pause (a) State transition diagram Enter Queue Dispatch Processor Exit Pause (b) Queuing diagram Figure 3.5 Two-State Process Model

Reasons for Process Creation

Process Creation Process spawning when the OS creates a process at the explicit request of another process Parent process is the original, creating, process Child process is the new process

Process Termination There must be a means for a process to indicate its completion A batch job should include a HALT instruction or an explicit OS service call for termination For an interactive application, the action of the user will indicate when the process is completed (e.g. log off, quitting an application)

Five-State Process Model New Admit Ready Dispatch Running Release Exit Timeout Event Occurs Event Wait Blocked Figure 3.6 Five-State Process Model

Process A Process B Process C Dispatcher 0 5 10 15 20 25 30 35 40 45 50 = Running = Ready = Blocked Figure 3.7 Process States for Trace of Figure 3.4

Admit Ready Queue Dispatch Processor Release Timeout Event Occurs Blocked Queue (a) Single blocked queue Event Wait Admit Ready Queue Dispatch Processor Release Timeout Event 1 Occurs Event 2 Occurs Event 1 Queue Event 2 Queue Event 1 Wait Event 2 Wait Event n Occurs Event n Queue Event n Wait (b) Multiple blocked queues Figure 3.8 Queuing Model for Figure 3.6

Swapping involves moving part of all of a process from main memory to disk when none of the processes in main memory is in the Ready state, the OS swaps one of the blocked processes out on to disk into a suspend queue

(a) With One Suspend State New New Ready/ Suspend Event Occurs Suspend Admit Admit Activate Activate Suspend Suspend Admit Ready Ready Event Occurs Event Occurs Blocked Dispatch Release Running Timeout Dispatch Release Running Timeout Suspend Event Wait Event Wait Exit Exit Blocked/ Suspend Activate Suspend New (a) Blocked With One Suspend State (b) With Two Suspend States Figure 3.9 Process State Transition Diagram with Suspend States Admit Admit Suspend

(a) With One Suspend State New Admit Admit Suspend Ready/ Suspend Activate Suspend Ready Dispatch Timeout Running Release Exit Event Occurs Event Occurs Event Wait Blocked/ Suspend Activate Suspend Blocked (b) With Two Suspend States Figure 3.9 Process State Transition Diagram with Suspend States

The process is not immediately available for execution The process may or may not be waiting on an event The process was placed in a suspended state by an agent: either itself, a parent process, or the OS, for the purpose of preventing its execution The process may not be removed from this state until the agent explicitly orders the removal

Reasons for Process Suspension

P 1 P 2 P n Virtual Memory Processor I/O I/O I/O Main Memory Computer Resources Figure 3.10 Processes and Resources (resource allocation at one snapshot in time)

Memory Devices Files Processes Memory Tables I/O Tables File Tables Process Image Process 1 Primary Process Table Process 1 Process 2 Process 3 Process Image Process n Process n Figure 3.11 General Structure of Operating System Control Tables

Used to keep track of both main (real) and secondary (virtual) memory Processes are maintained on secondary memory using some sort of virtual memory or simple swapping mechanism

Used by the OS to manage the I/O devices and channels of the computer system At any given time, an I/O device may be available or assigned to a particular process

These tables provide information about: existence of files location on secondary memory current status other attributes Information may be maintained and used by a file management system in which case the OS has little or no knowledge of files In other operating systems, much of the detail of file management is managed by the OS itself

Must be maintained to manage processes There must be some reference to memory, I/O, and files, directly or indirectly The tables themselves must be accessible by the OS and therefore are subject to memory management

To manage and control a process the OS must know: where the process is located the attributes of the process that are necessary for its management

Process Location A process must include a program or set of programs to be executed A process will consist of at least sufficient memory to hold the programs and data of that process The execution of a program typically involves a stack that is used to keep track of procedure calls and parameter passing between procedures Process Attributes Each process has associated with it a number of attributes that are used by the OS for process control The collection of program, data, stack, and attributes is referred to as the process image Process image location will depend on the memory management scheme being used

Each process is assigned a unique numeric identifier otherwise there must be a mapping that allows the OS to locate the appropriate tables based on the process identifier Many of the tables controlled by the OS may use process identifiers to cross-reference process tables Memory tables may be organized to provide a map of main memory with an indication of which process is assigned to each region similar references will appear in I/O and file tables When processes communicate with one another, the process identifier informs the OS of the destination of a particular communication When processes are allowed to create other processes, identifiers indicate the parent and descendents of each process

Consists of the contents of processor registers user-visible registers control and status registers stack pointers Program status word (PSW) contains condition codes plus other status information EFLAGS register is an example of a PSW used by any OS running on an x86 processor

The additional information needed by the OS to control and coordinate the various active processes

Process Identification Processor State Information Process Identification Processor State Information Process Identification Processor State Information Process Control Block Process Control Information Process Control Information Process Control Information User Stack User Stack User Stack Private User Address Space (Programs, Data) Private User Address Space (Programs, Data) Private User Address Space (Programs, Data) Shared Address Space Shared Address Space Shared Address Space Process 1 Process 2 Process n Figure 3.13 User Processes in Virtual Memory

Process Control Block Running Ready Blocked Figure 3.14 Process List Structures

The most important data structure in an OS contains all of the information about a process that is needed by the OS blocks are read and/or modified by virtually every module in the OS defines the state of the OS Difficulty is not access, but protection a bug in a single routine could damage process control blocks, which could destroy the system s ability to manage the affected processes a design change in the structure or semantics of the process control block could affect a number of modules in the OS

User Mode less-privileged mode user programs typically execute in this mode System Mode more-privileged mode also referred to as control mode or kernel mode kernel of the operating system

Process Management Typical Functions of an Operating System Kernel Process creation and termination Process scheduling and dispatching Process switching Process synchronization and support for interprocess communication Management of process control blocks Allocation of address space to processes Swapping Page and segment management Memory Management I/O Management Buffer management Allocation of I/O channels and devices to processes Interrupt handling Accounting Monitoring Support Functions

Once the OS decides to create a new process it: assigns a unique process identifier to the new process allocates space for the process initializes the process control block sets the appropriate linkages creates or expands other data structures

System Interrupts Interrupt Due to some sort of event that is external to and independent of the currently running process clock interrupt I/O interrupt memory fault Time slice the maximum amount of time that a process can execute before being interrupted Trap An error or exception condition generated within the currently running process OS determines if the condition is fatal moved to the Exit state and a process switch occurs action will depend on the nature of the error

If no interrupts are pending the processor: If an interrupt is pending the processor: proceeds to the fetch stage and fetches the next instruction of the current program in the current process 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 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 select another process for execution restore the context of the processor to that which existed at the time the selected process was last switched out update memory management data structures update the process control block of the process selected