CSE325 Principles of Operating Systems. Processes. David P. Duggan February 1, 2011

Similar documents
Processes and Non-Preemptive Scheduling. Otto J. Anshus

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc.

What we will learn. Multi Process Systems: Processes &Threads. Architectural support: Processor Modes. Processes (classic vs.

W4118 Operating Systems. Junfeng Yang

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

Reading Assignment 4. n Chapter 4 Threads, due 2/7. 1/31/13 CSE325 - Processes 1

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

Process Description and Control. Chapter 3

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

Process Time. Steven M. Bellovin January 25,

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Processes and Threads

Processes. Process Concept

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

Process Description and Control. Chapter 3

CSE 153 Design of Operating Systems Fall 2018

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

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Process Manager Overview

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

PROCESSES Gursharan Singh Tatla 24/01/2011

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

CSCE 313: Intro to Computer Systems

2 Processes. 2 Processes. 2 Processes. 2.1 The Process Model. 2.1 The Process Model PROCESSES OPERATING SYSTEMS

Roadmap. Tevfik Ko!ar. CSC Operating Systems Spring Lecture - III Processes. Louisiana State University. Virtual Machines Processes

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

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

Announcements Processes: Part II. Operating Systems. Autumn CS4023

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

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

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

Processes The Process Model. Chapter 2. Processes and Threads. Process Termination. Process Creation

Multiprogramming. Evolution of OS. Today. Comp 104: Operating Systems Concepts 28/01/2013. Processes Management Scheduling & Resource Allocation

Computer Systems II. First Two Major Computer System Evolution Steps

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

Operating Systems Process description and control

Module 4: Processes. Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess Communication

Module 4: Processes. Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess Communication

CSE 153 Design of Operating Systems

Diagram of Process State Process Control Block (PCB)

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

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

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

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

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Operating System Services

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

The Big Picture So Far. Chapter 4: Processes

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

Chapter 3: Process Concept

Chapter 3: Process Concept

Processes and Threads

OPERATING SYSTEMS. COMS W1001 Introduction to Information Science. Boyi Xie

Processes & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Processes. Dr. Yingwu Zhu

Lecture 4: Threads; weaving control flow

CSC 539: Operating Systems Structure and Design. Spring 2006

Chapter 3: Process Concept

Disciplina Sistemas de Computação

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

Threads, SMP, and Microkernels. Chapter 4

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)

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

Chapter 3: Processes

The Big Picture So Far. Chapter 4: Processes

Announcements. Operating Systems. Autumn CS4023

CHAPTER 2: PROCESS MANAGEMENT

Chapter 5: Threads. Outline

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

Threads Implementation. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Operating Systems. Lecture 05

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

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

CSE 120 Principles of Operating Systems

Process Description and Control

Lecture 4: Process Management

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

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

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

Chapter 4: Processes. Process Concept

Lecture 9: Midterm Review

Eastern Mediterranean University School of Computing and Technology Department of Information Technology. ITEC202 Operating Systems

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

Chapter 4: Processes

Process Description and Control

CSE 120 Principles of Operating Systems

3.1 Introduction. Computers perform operations concurrently

Process Description and Control. Chapter 3

CSE544 Database Architecture

Distributed Systems Operation System Support

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Lecture 2 Process Management

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

CSE 120 Principles of Operating Systems

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Transcription:

CSE325 Principles of Operating Systems Processes David P. Duggan dduggan@sandia.gov February 1, 2011

Today s Goal: 1. Process Concept 2. Process Manager Responsibilities 3. Process Scheduling 4. Operations on Processes 5. Cooperating Processes 6. Inter-process Communication 1/30/2011 CSE325 - Processes 2

Process Concept Early systems allowed one program at a time Poor utilization of expensive hardware Defn: A Process is an abstraction of a processor Process is also a program in execution Tighter control and compartmentalization Unit of work in modern time-sharing systems Modern systems consist of a collection of processes A program is static, a process is dynamic 1/30/2011 CSE325 - Processes 3

Basic Abstractions Idea Program Abstract Machine Result Idea Program Abstract Machine Physical Machine Result Idea Program Abstract Machine Result 4

How Multiprogramming Works Process 1 Process 2 Process 3 Process 4 Processor Time-multiplexed CPU Space-multiplexed Memory 1/30/2011 CSE325 - Processes 5

Process Abstraction Data Program Process Stack Operating System Hardware Processor Executable Memory 1/30/2011 CSE325 - Processes 6

Implementing the Process Abstraction P i CPU P j CPU P k CPU P i Executable Memory P j Executable Memory P k Executable Memory OS interface 1/30/2011 CPU ALU Control Unit OS Address Space P i Address Space P k Address Space P j Address Space Machine Executable Memory 7

Formal Model The process concept is used to model: The states of a system state Some sequence of status values computation Means of generating a class of such sequences action function State-variables Elementary quantities Can assume well-defined values State Mapping from state-variables into values 1/30/2011 CSE325 - Processes 8

Formal Model, contd State Space Set of possible states for a given set of state-variables Computation Sequence of states, starting with the initial state Action Function Mapping from states into states Process is a triple (S,f,I), where S: state space f: action function in that state space I <= S: set of initial states 1/30/2011 CSE325 - Processes 9

Formal Model, contd A process generates all computations generated by its action function from its initial states Intuitively the variable set is memory a state gives the contents of memory the action function is a program If two processes have disjoint state variable sets, they cannot interact Communication among processes is modeled by shared variables Multiple processes may share WHAT, acting on different variable sets 1/30/2011 CSE325 - Processes 10

External View of the Process Manager Application Program wait() fork() exec() CreateThread() CloseHandle() CreateProcess() WaitForSingleObject() Device Mgr Process Mgr Memory Mgr File Mgr UNIX Device Mgr Process Mgr Memory Mgr File Mgr Windows Hardware 1/30/2011 11

Process Manager Overview Program Process Abstract Computing Environment Device Manager File Manager Memory Manager Protection Deadlock Synchronization Scheduler Process Description Resource Resource Manager Resource Manager Manager Devices Memory CPU Other H/W 12

Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks We use the terms job and process almost interchangeably. Process a program in execution; process execution must progress in sequential fashion. A process includes: program counter stack data section 13

Algorithms, Programs, and Processes Idea Execution Engine Algorithm Status Stack Files Files Files Source Program Binary Program Data Other Resources 1/30/2011 Process 14

Process State As a process executes, it changes state new: The process is being created. ready: The process is waiting to be assigned to a processor. running: Instructions are being executed. waiting: The process is waiting for some event to occur. terminated: The process has finished execution. 1/30/2011 CSE325 - Processes 15

Diagram of Process State Program 1/30/2011 CSE325 - Processes 16

UNIX State Transition Diagram Wait by parent Zombie Sleeping Done Request I/O Request Request Running Allocate Schedule Start I/O Complete Resume Runnable Uninterruptible Traced or Stopped Sleep 1/30/2011 CSE325 - Processes 17

Windows NT Thread States CreateThread Terminated Reinitialize Initialized Running Exit Wait Dispatch Activate Waiting Wait Complete Ready Wait Complete Transition Select Preempt Dispatch Standby 1/30/2011 CSE325 - Processes 18

Address Space Process must be able to reference every resource in its abstract machine Assign each unit of resource an address Most addresses are for memory locations Abstract device registers Mechanisms to manipulate resources Addresses used by one process are inaccessible to other processes Say that each process has its own address space 1/30/2011 CSE325 - Processes 19

Process & Address Space Code Data Stack Resources Resources Resources Abstract Machine Environment Address Space 1/30/2011 CSE325 - Processes 20

The Address Space Address Space Address Binding Executable Memory Process Files Other objects 1/30/2011 21

Process Control Blocks (PCB) or Process Descriptors Information (data structure) associated with each process. Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information 1/30/2011 CSE325 - Processes 22

Process Control Block (PCB) 1/30/2011 23

Windows NT Process Descriptor NT Kernel NT Executive EPROCESS KPROCESS uint32 KernelTime; uint32 UserTime; Byte state; void *UniqueProcessId; 1/30/2011 CSE325 - Processes 24

CPU Switch From Process to Process 1/30/2011 CSE325 - Processes 25

Context Switching Interrupt Initialization 1 7 2 Process Manager Interrupt Handler 8 Executable Memory 3 9 4 P 1 5 P 2 6 P n 1/30/2011 26

Context Switch When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process. Context-switch time is overhead; the system does no useful work while switching. Time dependent on hardware support. How to reduce context-switch overheads? 1/30/2011 CSE325 - Processes 27