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

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

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

Chap 4, 5: Process. Dongkun Shin, SKKU

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

What is a Process. Processes. Programs and Processes. System Classification 3/5/2013. Process: An execution stream and its associated state

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

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

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Processes. Process Concept

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

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

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

Process Description and Control. Chapter 3

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

Process Description and Control. Chapter 3

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

Operating System Control Structures

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Processes. CS3026 Operating Systems Lecture 05

Major Requirements of an OS

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Computer Systems II. First Two Major Computer System Evolution Steps

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Process Concepts 8/21/2014. CS341: Operating System. Scheduling: Theoretical Analysis

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

Chapter 3: Processes. Operating System Concepts Essentials 2 nd Edition

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

Operating Systems Process description and control

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

3.1 Introduction. Computers perform operations concurrently

CSC 539: Operating Systems Structure and Design. Spring 2006

Process Description and Control. Major Requirements of an Operating System

Major Requirements of an Operating System Process Description and Control

Processes. Dr. Yingwu Zhu

CS399 New Beginnings. Jonathan Walpole

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

W4118 Operating Systems. Junfeng Yang

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

Diagram of Process State Process Control Block (PCB)

CS 333 Introduction to Operating Systems Class 2 OS-Related Hardware & Software The Process Concept

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

Why use an Operating System? Operating System Definition

Operating Systems. Lecture 05

Process Description and Control. Chapter 3

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

Mon Sep 17, 2007 Lecture 3: Process Management

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

Process Description and Control

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

2 Introduction to Processes

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

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

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

The Big Picture So Far. Chapter 4: Processes

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

Chapter 3: Processes

Process Description and Control

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

CS 333 Introduction to Operating Systems. Class 2 OS-Related Hardware & Software The Process Concept

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)

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Chapter 3: Processes. Chapter 3: Processes. Process in Memory. Process Concept. Process State. Diagram of Process State

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

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

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

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

Process. Discussion session 3 1/30/2016

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

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

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Lecture 4: Memory Management & The Programming Interface

Lecture 4: Process Management

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

518 Lecture Notes Week 3

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

Process Description and Control

Today: Process Management. The Big Picture So Far. What's in a Process? Example Process State in Memory

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

The Big Picture So Far. Today: Process Management

Process Time. Steven M. Bellovin January 25,

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

CSC 4320 Test 1 Spring 2017

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

Processes, PCB, Context Switch

Lecture 3: Processes. CMPUT 379, Section A1, Winter 2014 January 13, 15 and 17

COSC243 Part 2: Operating Systems

3. Process Management in xv6

Operating System Structure

The Big Picture So Far. Chapter 4: Processes

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

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

CPU/Process Management : Objectives & Challenges. Data Structures for CPU Management

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

OPERATING SYSTEMS: Lesson 4: Process Scheduling

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

Operating Systems. II. Processes

CHAPTER 2: PROCESS MANAGEMENT

Transcription:

Processes Sanzheng Qiao Department of Computing and Software December, 2012

What is a process? The notion of process is an abstraction. It has been given many definitions. Program in execution is the most frequently referenced one. Is a process the same as a program?

What is a process? The notion of process is an abstraction. It has been given many definitions. Program in execution is the most frequently referenced one. Is a process the same as a program? No. It s both more and less. More: When a child process (e.g., ls) terminates, it signals its parent process (the shell). A process has the information about its parent/child processes. Less: Program cc uses several processes.

Address space Each process is associated with an address space: All the state needed to run a program (execution stack, system environment, etc.). It contains all the addresses that can be touched by the program. Why address space: Protection. A process can only access its own address space. A process is represented by its Process Control Block (PCB): Address space. Execution state (PC, saved registers).

PCB process control block id stack status priority registers open files address space

PCB Scheduling information (priority). Accounting information (CPU time). Open files. Other miscellaneous information. OS maintains a process table (a collection of all PCBs) to keep track of all the processes. In UNIX the process table is a fixed-size array.

Process states New: Just created Waiting: Waiting for an event to occur. Ready: Has acquired all the resources but the CPU. Running: Running on the CPU. Finish: Exiting. Processes switch from one state to another, OS controls this.

Process states new admitted timer interrupt exit finish ready running dispatched event completion wait for an event waiting

Dispatcher With many processes on the the system, OS must take care of: scheduling: each process gets a fair share of the CPU time. protection: processes don t modify each other.

Dispatcher With many processes on the the system, OS must take care of: scheduling: each process gets a fair share of the CPU time. protection: processes don t modify each other. Dispatcher: 1 Run process for a while 2 Pick a process from the ready queue 3 Save state (PC, registers, etc.) 4 Load state of next process 5 Run (load PC register)

Dispatcher When a user process is switched out of the CPU, its state must be saved in its PCB. Everything could be damaged by the next process: Program counter. Processor status word. Registers (General purpose and floating-point).

Exceptions The CPU can run only one at a time. When a user process is running, the dispatcher (part of OS) is not running. How can OS regain control of the CPU? Exceptions: User process gives up the CPU to OS (caused by internal events, for example, go to sleep) System call. Error (eg. bus error, segmentation error, overflow, etc.). Page fault. Yield. These are also called traps.

Interrupts Interrupts: The OS interrupts user process (caused by external events): Completion of an input (eg. a character typed at keyboard) Completion of an output (a character displayed at terminal) Completion of a disk transfer A packet is sent to the network. Timer (alarm clock).

Process creation Creating a process from scratch: 1 Load code and data into memory. 2 Set up a stack. 3 Initialize PCB. 4 Make process known to dispatcher.

Process creation Forking a process: 1 Make sure the parent process is not running and has all state saved. 2 Make a copy of code, data, and stack. 3 Make a copy of PCB of the parent process into the child process. 4 Make the child process known to dispatcher.

Example UNIX fork() and exec(). The system call fork() is called by one process and returned in two processes. Parent: returns child pid Child: returns 0 pid = fork(); if (pid == 0) /* child process */ exec("executable"); /* parent process continues */ In the child process, executable overwrites the old program.

Process termination Terminating when it finishes the last statement and calls exit. Deallocate memory (physical and virtual) Close open files Notify its parent process

Process termination Terminated by another process, usually the parent, using system call abort or kill. The child has exceeded some resource quota The child s task is no longer needed The parent is exiting