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

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

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Chap 4, 5: Process. Dongkun Shin, SKKU

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

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

Chapter 3: Processes

PROCESSES. Jo, Heeseung

Processes. Jo, Heeseung

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

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

CHAPTER 3 - PROCESS CONCEPT

Chapter 3: Process Concept

Chapter 3: Process Concept

Chapter 3: Process Concept

Processes. Dr. Yingwu Zhu

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Processes. Process Concept

Announcements Processes: Part II. Operating Systems. Autumn CS4023

Chapter 3: Processes

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

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

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

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

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

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

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

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

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

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Chapter 3: Processes. Operating System Concepts 9 th Edition

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

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processes COMPSCI 386

Operating System Design

Chapter 3: Processes. Operating System Concepts 9 th Edition

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

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

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

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

Computer Systems II. First Two Major Computer System Evolution Steps

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

Chapter 3: Processes

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

csci3411: Operating Systems

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

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

Processes. Operating System Concepts 8 th Edition

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

OS Structure. User mode/ kernel mode. System call. Other concepts to know. Memory protection, privileged instructions

W4118 Operating Systems. Junfeng Yang

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

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Process and Its Image An operating system executes a variety of programs: A program that browses the Web A program that serves Web requests

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

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

Processes and Threads

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

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

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

Operating System Concepts Ch. 3: Processes

Lecture 4: Process Management

Processes and Non-Preemptive Scheduling. Otto J. Anshus

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

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

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

CS370 Operating Systems

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

The Big Picture So Far. Today: Process Management

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

Operating System Structure

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

Chapter 3: Process Concept

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

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

OS Structure. User mode/ kernel mode (Dual-Mode) Memory protection, privileged instructions. Definition, examples, how it works?

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

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

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

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

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

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

Memory Management. Disclaimer: some slides are adopted from book authors slides with permission 1

Operating Systems 2 nd semester 2016/2017. Chapter 4: Threads

Unix Processes. What is a Process?

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

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

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

TDIU25: Operating Systems II. Processes, Threads and Scheduling

CS510 Operating System Foundations. Jonathan Walpole

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

Processes and Threads

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

Killing Zombies, Working, Sleeping, and Spawning Children

Thread and Synchronization

Distributed Systems CSCI-B 534/ENGR E-510. Spring 2019 Instructor: Prateek Sharma

COMP 3430 Robert Guderian

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

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

Diagram of Process State Process Control Block (PCB)

Transcription:

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

Recap OS services Resource (CPU, memory) allocation, filesystem, communication, protection, security, I/O operations OS interface System-call interface OS structure Monolithic, microkernel Loadable module 2

Roadmap Beginning of a series of important topics: Process Thread Synchronization Today Process concept Context switching 3

Process Process An OS abstraction represents a running application Three main components Address space The process s view of memory Includes program code, global variables, dynamic memory, stack Processor state Program counter (PC), stack pointer, and other CPU registers OS resources Various OS resources that the process uses E.g.) open files, sockets, accounting information 4

Process Address Space Text Program code Data Global variables Heap Dynamically allocated memory Stack i.e., Malloc() Temporary data Grow at each function call 5

Process Address Space Each process has its own private address space 2 32 (4GB) of continuous memory in a 32bit machine Each has same address range (e.g., 0x0 ~ 0xffffffff) How is this possible? What if you have less than 4GB physical DRAM? What if you have 100 processes to run? Virtual memory An OS mechanism providing this illusion We will study it in great detail later in the 2 nd half of the semester 6

Virtual Memory vs. Physical Memory Virtual Memory Process A Process B Process C Physical Memory 7

Process State 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 8

Process Control Block (PCB) Information associated with each process Process id Process state running, waiting, etc. Saved CPU registers Register values saved on the last preemption CPU scheduling information priorities, scheduling queue pointers Memory-management information memory allocated to the process Accounting information CPU used, clock time elapsed since start, time limits OS resources Open files, sockets, etc. 9

Process in Linux Represented by the C structure task_struct (include/linux/sched.h) pid t_pid; /* process identifier */ long state; /* state of the process */ u64 vruntime; /* CFS scheduling information */ struct files_struct *files;/* list of open files */ struct mm_struct *mm; /* address space of this process */ cputime_t utime, stime; /* accounting information */ struct thread_struct thread; /* CPU states */ (very big structure: 5872 bytes in my desktop *) (*) # cat /sys/kernel/slab/task_struct/object_size 10

Process Scheduling Decides which process to run next Among ready processes We cover in much more detail later in the class but let s get some basics OS maintains multiple scheduling queues Ready queue ready to be executed processes Device queues processes waiting for an I/O device Processes migrate among the various queues 11

Ready Queue and I/O Device Queues 12

Process Scheduling: Queuing Representation 13

Context Switching Suspend the current process and resume a next one from its last suspended state 14

Context Switching Overhead Save and restore CPU states Warm up instruction and data cache Cache data of previous process is not useful for new process In Linux 3.6.0 on an Intel Xeon 2.8Ghz About 1.8 us ~ 5040 CPU cycles ~ thousands of instructions 15

Process Creation Parent process create children processes, which, in turn create other processes, forming a tree of processes Generally, process identified and managed via a process identifier (pid) 16

A Process Tree in Linux 17

pstree output 18

Process Creation 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 19

Example: Forking a Process in UNIX Child Parent 20

Example: Forking a Process in Windows 21

Process Termination Normal termination via exit() system call. Exit by itself. Returns status data from child to parent (via wait()) Process s resources are deallocated by operating system Forced termination via kill() system call Kill someone else (child) Zombie process If no parent waiting (did not invoke wait()) Orphan process If parent terminated without invoking wait Q: who will be the parent of a orphan process? A: Init process 22