Processes. Process Concept

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

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

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

Processes. Operating System Concepts with Java. 4.1 Sana a University, Dr aimen

Processes. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & Apps 1

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

Chapter 4: Processes. Process Concept

Chapter 4: Processes

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

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

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

Process Concept. Chapter 4: Processes. Diagram of Process State. Process State. Process Control Block (PCB) Process Control Block (PCB)

Chapter 4: Processes

Chapter 4: Processes. Process Concept

Part Two - Process Management. Chapter 3: Processes

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

Diagram of Process State Process Control Block (PCB)

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

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

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

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

The Big Picture So Far. Chapter 4: Processes

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

CS Lecture 2! Processes! George Mason University! Fall 2010!

The Big Picture So Far. Chapter 4: Processes

Processes and Threads

Chapter 4: Processes. Process Concept. Process State

Chapter 3: Processes

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

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

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

Chapter 3: Process Concept

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

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

Chapter 4: Processes

Chapter 3: Process Concept

Chapter 3: Process Concept

COP 4610: Introduction to Operating Systems (Spring 2014) Chapter 3: Process. Zhi Wang Florida State University

Notice: This set of slides is based on the notes by Professor Perrone of Bucknell and the textbook authors Silberschatz, Galvin, and Gagne

2. PROCESS. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

Chapter 3: Process Concept

CHAPTER 2: PROCESS MANAGEMENT

Chapter 3: Processes

Processes. CSE 2431: Introduction to Operating Systems Reading: Chap. 3, [OSC]

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Lecture 2 Process Management

COP 4610: Introduction to Operating Systems (Spring 2016) Chapter 3: Process. Zhi Wang Florida State University

Process Concept. Minsoo Ryu. Real-Time Computing and Communications Lab. Hanyang University.

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

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

CSCE 313: Intro to Computer Systems

Chapter 3: Processes. Operating System Concepts 8th Edition

Chapter 3: Processes

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

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Process. Operating Systems (Fall/Winter 2018) Yajin Zhou ( Zhejiang University

Processes and Threads

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

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

CSC 539: Operating Systems Structure and Design. Spring 2006

Course: Operating Systems Instructor: M Umair. M Umair

Processes. Dr. Yingwu Zhu

Chapter 3: Processes. Operating System Concepts 9 th Edition

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

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

CHAPTER 3 - PROCESS CONCEPT

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

CS307 Operating Systems Processes

Processes. Process Concept. The Process. The Process (Cont.) Process Control Block (PCB) Process State

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

Operating Systems & Concurrency: Process Concepts

Processes & Threads. Recap of the Last Class. Microkernel System Architecture. Layered Structure

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

Chapter 3: Process Concept

Operating System Design

Process Concept Process Scheduling Operations On Process Inter-Process Communication Communication in Client-Server Systems

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

CS370 Operating Systems

Chapter 3: Processes. Operating System Concepts 9 th Edition

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

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

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

Page 1. Analogy: Problems: Operating Systems Lecture 7. Operating Systems Lecture 7

Processes. CS3026 Operating Systems Lecture 05

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

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

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

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

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

Processes & Threads. Recap of the Last Class. Layered Structure. Virtual Machines. CS 256/456 Dept. of Computer Science, University of Rochester

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

Chapter 3 Process Description and Control

Chap 4, 5: Process. Dongkun Shin, SKKU

CSC 1600 Unix Processes. Goals of This Lecture

W4118 Operating Systems. Junfeng Yang

Killing Zombies, Working, Sleeping, and Spawning Children

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

Transcription:

Processes These slides are created by Dr. Huang of George Mason University. Students registered in Dr. Huang s courses at GMU can make a single machine readable copy and print a single copy of each slide for their own reference as long as the slide contains the copyright statement, and the GMU facilities are not used to produce the paper copies. Permission for any other use, either in machine-readable or printed form, must be obtained form the author in writing. CS471 1 Process Concept A system executes more than one program at a time. Process a program in execution. Called task on Windows. If you are running three copies of the same program, there will be three processes. Try to open multiple Explorers and use Task Manager to see the number of tasks. Textbook uses the terms job and process interchangeably. CS471 2 1

Process State As a process executes, it changes state new: The process is being created. running: Instructions are being executed. waiting: The process is waiting for some event to occur. ready: The process is waiting to be assigned to a processor. terminated: The process has finished execution. CS471 3 Diagram of Process State CS471 4 2

The Existence of Processes in Memory PCB i PCB j Process Image i Process Image j Kernel memory Rest of memory CS471 5 Process Image: the process itself Program code Data Shared libraries PCB: A kernel data structure that the OS use to keep track of a process One PCB per process CS471 6 3

Process Control Block (PCB) Process state Program counter CPU registers CPU scheduling information Memory-management information Accounting information I/O status information CS471 7 CPU Switch From Process to Process CS471 8 4

Process Scheduling Queues Job queue set of all processes in the system. Ready queue set of all processes residing in main memory, ready and waiting to execute. Device queues set of processes waiting for an I/O device. Process migration between the various queues. CS471 9 Processe Queues CS471 10 5

Representation of Process Scheduling CS471 11 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. CS471 12 6

Process Creation Parent process create children processes, which, in turn create other processes, forming a tree of processes. Resource sharing Parent and children share all resources. Children share subset of parent s resources. Parent and child share no resources. Execution Parent and children execute concurrently. Parent waits until children terminate. CS471 13 Process Creation (Cont.) Address space Child duplicate of parent. Child has a program loaded into it. UNIX examples fork system call creates new process exec system call used after a fork to replace the process memory space with a new program. CS471 14 7

Process Creation in Unix void main () { int pid; pid = fork(); if (pid < 0) {error_msg} else if (pid == 0) { /* child process */ execlp( /bin/ls, ls, NULL); else { /* parent process */ /* parent will wait for the child to complete */ wait(null); exit(0); } } CS471 15 Process Termination Process executes last statement and asks the operating system to decide it (exit). Output data from child to parent (via wait). Process resources are deallocated by operating system. Parent may terminate execution of children processes (abort). Task assigned to child is no longer required. Parent is exiting. CS471 16 8

Cooperating Processes Independent process cannot affect or be affected by the execution of another process. Cooperating process can affect or be affected by the execution of another process Advantages of process cooperation Information sharing Computation speed-up Modularity Convenience CS471 17 Inter-Process Communications Direct communication Setup a channel between two processes Indirect communication The sender stores the message in a mailbox, waiting for the retrieval by the receiving process. The mailbox is a kernel data structure. CS471 18 9

Synchronization Message passing may be either blocking or non-blocking. Blocking Waiting for the operation to complete considered synchronous Non-blocking Proceeding without waiting for completion considered asynchronous CS471 19 Visualization CS471 20 10

Why Multiple Identical Processes? Imagine you are creating a web server program Design Choice 1: handle all clients with one process The code will have to deal with thousands of concurrent users and thus quite complicated Design Choice 2: Handle only one client When seeing a new client, clone the process Both the original and the clone handle only one client. CS471 21 Remember that the cloning is done by the fork() system call. Many servers are implemented this way. There is a performance problem however. Forking a process imposes significant overhead The problem is worse when a server is handling thousands of clients (and thus processes) We want to reduce the overheads of process creation/termination and memory footage. CS471 22 11

Light Weight Process: Thread A thread uses the program code and data files of a hosting process. A thread has its own program counter, memory data and stack for independent execution. Reducing the overhead of multiple, identical processes. CS471 23 Single-Thread Process Files in use Register Contents Program Counter Program Code Data and Stack CS471 24 12

Multi-threaded Process Register Contents Program Counter Files in use Register Contents Program Counter Program Code Data and Stack Data and Stack CS471 25 13