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

Similar documents
3.1 Introduction. Computers perform operations concurrently

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

Process Description and Control

SMD149 - Operating Systems

Computer Systems II. First Two Major Computer System Evolution Steps

Process Description and Control

Chap 4, 5: Process. Dongkun Shin, SKKU

Process Description and Control. Chapter 3

Major Requirements of an OS

Processes. Dr. Yingwu Zhu

Process Description and Control. Chapter 3

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

Operating System Structure

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

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

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

Operating System Control Structures

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

Process Description and Control. Chapter 3

Processes. Sanzheng Qiao. December, Department of Computing and Software

Process Management Rab Nawaz Jadoon

W4118 Operating Systems. Junfeng Yang

Processes and Non-Preemptive Scheduling. Otto J. Anshus

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

CS 111. Operating Systems Peter Reiher

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

Processes and Threads

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

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

IT 540 Operating Systems ECE519 Advanced Operating Systems

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

CSCE Introduction to Computer Systems Spring 2019

Chapter 3: Processes

CSC 539: Operating Systems Structure and Design. Spring 2006

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

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

CS 111. Operating Systems Peter Reiher

Processes. CS3026 Operating Systems Lecture 05

Why use an Operating System? Operating System Definition

Process Description and Control

CSC 4320 Test 1 Spring 2017

* What are the different states for a task in an OS?

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

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

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

Process Description and Control

Course: Operating Systems Instructor: M Umair. M Umair

Process Scheduling Queues

Operating System. Operating System Overview. Structure of a Computer System. Structure of a Computer System. Structure of a Computer System

Lecture 4: Process Management

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Processes. Johan Montelius KTH

Process a program in execution; process execution must progress in sequential fashion. Operating Systems

CSE 380 Computer Operating Systems. Instructor: Insup Lee. University of Pennsylvania Fall 2003

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

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

A process. the stack

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Design Overview of the FreeBSD Kernel CIS 657

Processes. Process Scheduling, Process Synchronization, and Deadlock will be discussed further in Chapters 5, 6, and 7, respectively.

What is a Process? Processes and Process Management Details for running a program

Operating Systems Overview. Chapter 2

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Unix Processes. What is a Process?


Mon Sep 17, 2007 Lecture 3: Process Management

Process. Discussion session 3 1/30/2016

Process. Program Vs. process. During execution, the process may be in one of the following states

OS Structure, Processes & Process Management. Don Porter Portions courtesy Emmett Witchel

Operating System Design

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

Chapter 3: Processes. Operating System Concepts 8th Edition, modified by Stewart Weiss

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

CSCE 313: Intro to Computer Systems

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

Wednesday, September 14, Chapter 3: Processes

Chapter 3: Process-Concept. Operating System Concepts 8 th Edition,

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

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

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

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

Chapter 3: Processes

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved.

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016

Operating Systems. Review ENCE 360

o Reality The CPU switches between each process rapidly (multiprogramming) Only one program is active at a given time

Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions

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

CS 355 Operating Systems. Keeping Track of Processes. When are processes created? Process States 1/26/18. Processes, Unix Processes and System Calls

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

Inter-Process Communication and Synchronization of Processes, Threads and Tasks: Lesson-1: PROCESS

Processes. CS 416: Operating Systems Design, Spring 2011 Department of Computer Science Rutgers University

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

The Kernel Abstraction. Chapter 2 OSPP Part I

Chapter 3: Process Concept

Chapter 3: Process Concept

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

Transcription:

CSC400 - Operating Systems 3. Process Concepts J. Sumey Overview Concurrency Processes & Process States Process Accounting Interrupts & Interrupt Processing Interprocess Communication CSC400 - Process Concepts 2 CSC400 Operating Systems 1

Concurrency ability to perform multiple actions at the same time (but not simultaneously) can truly only run as many tasks as there are processors available thus: multiprogramming rapid switching of a processor among multiple, independent, sequential processes in a fashion that makes it appear that all processes are running simultaneously ex: CPU timeline CSC400 - Process Concepts 3 Multiprogramming Side Effect programmer can not make assumptions about timing! because processor is shared with other processes otherwise, processes need not be concerned about underlying multiprogramming environment CSC400 - Process Concepts 4 CSC400 Operating Systems 2

Concurrency Levels 1. OS can run multiple processes multiple tasks typically independent 2. apps can have multiple threads multiple paths of execution within a single application usually dependent CSC400 - Process Concepts 5 Processes entity of a running program, a.k.a. task includes processor state & address space i.e. a "virtual CPU" memory diagram see refs demo: sizes.c CSC400 - Process Concepts 6 CSC400 Operating Systems 3

Processes process address space: text region contains the compiler-generated machine code fixed size by compiler set to "read-only" by loader data (static) region static variables: both global & local subdivided into initialized and uninitialized areas stack for subroutine linkage, parameters & local variables heap (opt.) for dynamically (runtime) allocated objects: malloc(), new CSC400 - Process Concepts 7 Process States 3 possible conditions of a given process: 1. running currently executing on a processor 2. blocked a suspended condition resulting from an I/O request or other event 3. ready process is runnable but awaiting processor time * modern OSs usually define some additional states like suspend CSC400 - Process Concepts 8 CSC400 Operating Systems 4

State Transition Diagram Dispatch Running Timeout Block Exit Blocked Entry Ready Wakeup ready processes maintained in ready queue blocked processes in blocked queue[s] CSC400 - Process Concepts 9 Process State Transitions insertion into ready list process creation ready run processor available run ready time slot (quantum) expiration run blocked I/O request or IPC event (user initiated) blocked ready I/O complete or IPC synchronization removal process completion (normal or abnormal) CSC400 - Process Concepts 10 CSC400 Operating Systems 5

Process Operations create destroy dispatch block wake up change priority suspend / resume facilitate IPC CSC400 - Process Concepts 11 Process Procreation fork / spawn concept of a parent process "cloning" itself into another child process that typically mutates into some other program Unix ex: init login shell process hierarchies parent-child relationships resulting from creating & destroying processes CSC400 - Process Concepts 12 CSC400 Operating Systems 6

Process Accounting OS keeps track of all processes using a process table of process control blocks (PCBs) PCB contains everything OS needs to manage the process process ID (PID, PPID), state, priority, privileges parent & child process pointers address space descriptors execution context (processor registers, stack) allocated resources (files, I/O devices, etc.) CSC400 - Process Concepts 13 Process/Context Switching stopping a running process and switching to some other ready process save execution context of running process in its PCB, update other PCB contents move PCB to appropriate queue load a ready process's previously saved context from its PCB process-switch time must be minimized occurs extremely frequently is pure overhead CSC400 - Process Concepts 14 CSC400 Operating Systems 7

Process Switch Causes interrupts clock/timer, I/O, faults traps exception to normal process execution supervisor call OS services, ex: open file CSC400 - Process Concepts 15 Process Scheduler the [very important] part of the OS that handles task switching (i.e. processor scheduling) via some prescribed algorithm yields a process-structured OS model must balance overall system efficiency with individual process fairness (including the OS) also includes interrupt processing (sometimes done in assembly) CSC400 - Process Concepts 16 CSC400 Operating Systems 8

Interrupts & Interrupt Processing Interrupts Happen! process traps (synchronous) math errors: divide by 0 protection violation: privileged instruction, illegal memory reference software interrupt, breakpoint external events (asynchronous) I/O hardware IPC CSC400 - Process Concepts 18 CSC400 Operating Systems 9

Interrupt Handlers in response to an interrupt, processor suspends current task and vectors to an interrupt handler is never called synchronously more efficient than polling when handling I/O devices but somewhat more complicated to program and debug CSC400 - Process Concepts 19 Interrupt Processing Sequence 1. CPU interrupt line is activated timers, I/O controllers, coprocessors 2. CPU completes current instruction then saves states (on stack) 3. CPU vectors to appropriate handler typically via vector table 4. interrupt handler processes interrupt 5. previous state (and process) is restored via special instruction (rti/rte, irt) CSC400 - Process Concepts 20 CSC400 Operating Systems 10

Interprocess Communication IPC Why? OS facility to support communications between sending & receiving processes for data exchange, synchronization, etc. ex: DBMSs, web servers, gaming controlled mechanism to legitimately circumvent memory protection mechanisms CSC400 - Process Concepts 22 CSC400 Operating Systems 11

Signals a type of software interrupt used to notify a process of some event data exchange process synchronization / timing failures user CSC400 - Process Concepts 23 Signal Handling a process can arrange with the OS a certain disposition for signals masked blocked (OS does not send) catch specify a routine the OS will call when signal is sent to the process ignore i.e. disabled default typically abort, w/ memory dump CSC400 - Process Concepts 24 CSC400 Operating Systems 12

IPC Implementations shared memory mapping of a common range of memory to multiple processes message passing process-defined data exchange via OS-supplied queues pipes memory-based using file model access is synchronized by OS sockets like pipes only between process on different hosts CSC400 - Process Concepts 25 References processes: http://www.geeksforgeeks.org/memory-layout-of-c-program/ http://codingfreak.blogspot.com/2012/03/memory-layout-of-c-program-part- 1.html CSC400 - Process Concepts 26 CSC400 Operating Systems 13